View Full Version : ClanLib 0.9 OpenGL Fonts
rombust
09-04-2008, 03:59 PM
Should the OpenGL fonts be moved from GL into Display ?
Since window creation was moved into Display, this should now be possible.
The reasoning for this is that the fonts do not access GL directly, they can go through the CL_GraphicContext interface.
Also, this would be beneficial for the DirectX targets, a separate font class would not need writing.
Any thoughts?
Magnus Norddahl
09-04-2008, 08:25 PM
This is a tricky issue.
Strictly speaking fonts can be implemented completely generic outside the clanDisplay provider interface. So this votes in favor for your proposal to simply make all targets use the same font implementation.
However, the reason I made it part of the implementation in the first place is actually the GDI target. With the pending revision of the clanDisplay API where we add a couple of 'Standard Shader Programs' powering our 2D engine, the idea that the GDI target will only support these programs and not any custom shader code. In principle this target will still be able to render generic fonts, since the font stuff would just use these shaders, but I fear the speed might not match native Win32 functions such as DrawText. So I chose at the time to simply make text rendering a special 'primitive' type for the display abstraction, thus allowing a software target to use a different method to render them.
All that said, I really would prefer to have the fonts in 0.9 moved to clanDisplay for the sake of the D3D targets. I'm just not entirely sure if a GDI target will be good at text if we do this. It all depends on how fast that target can render the glyphs.
rombust
09-05-2008, 09:57 AM
I have now moved fonts out of OpenGL and into Display.
Also, i have implemented the fonts for DirectX9.
For GDI, you can either use the standard implementation or a generic one.
In CL_GraphicContextProvider::alloc_font(...)
You add:
return new CL_FontProvider_Native(this,...);
or
return new CL_FontProvider_GDI_Special_Font(this,...);
The font implementation has moved into the directory: Sources/Display/Font
I hope it is all okay.
Magnus Norddahl
09-05-2008, 11:45 AM
Excellent :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.