DirectX字体教程,不使用GDI [英] DirectX Font tutorial that doesn't use GDI

查看:172
本文介绍了DirectX字体教程,不使用GDI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有任何教程/信息在本机directx 9中创建和渲染字体,不使用GDI? (例如不使用ID3DXFont)。

我读到这不是最好的解决方案(由于访问GDI),但什么是'正确的'在dx中渲染字体的方式? / p>

Does anyone have any tutorials/info for creating and rendering fonts in native directx 9 that doesn't use GDI? (eg doesn't use ID3DXFont).
I'm reading that this isn't the best solution (due to accessing GDI) but what is the 'right' way to render fonts in dx?

推荐答案

ID3DXFont是一个伟大的事情,易于使用,早期,调试输出。但是,它确实使用GDI进行字体光栅化(而不是硬件加速),并且存在显着的性能损失(尝试它,它实际上非常显着)。但是,DirectX 11的字体将使用Direct2D渲染,并且硬件加速。

ID3DXFont is a great thing for easy to use, early, debug output. However, it does use the GDI for font rasterization (not hardware accelerated) and there is a significant performance hit (try it, its actually very noticable). As of DirectX 11, though, fonts will be rendered with Direct2D and be hardware accelerated.

渲染文本的最快方式是使用位图字体。我将解释如何做到这一点,除了有很多不同的方法来实现这种技术,每个不同的复杂性和能力。它可以像加载预创建的纹理并从中绘制字母的系统一样简单,也可以是一个系统,该系统静默地在Windows中注册字体并在加载时在内存中创建纹理(我与朋友开发的引擎这是,这是非常光滑)。无论如何,你应该看到一个非常显着的性能提高与位图字体。

The fastest way to render text is using what's called "Bitmap Fonts". I would explain how to do this, except that there is a lot of different ways to do implement this technique, each differing in complexity and capability. It can be as simple as a system that loads a pre-created texture and draws the letters from that, or a system that silently registers a font with Windows and creates a texture in memory at load-time (The engine I developed with a friend did this, it was very slick). Either way, you should see a very noticable performance increase with bitmap fonts.

这篇关于DirectX字体教程,不使用GDI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆