C++ D3DX 字体和转换(需要 d3d9 和 d3d10 解决方案)

发布于 2024-07-25 20:45:50 字数 363 浏览 5 评论 0原文

我想以考虑当前变换和类似设置的方式渲染字体,特别是投影变换和视口。

我认为最好的方法是使用一个离屏表面来渲染文本,然后在我真正想要文本的地方渲染该表面。

然而,我对该解决方案的许多方面都不确定。

  • 这是最好的解决方法吗?

  • 是否有更好的免费字体渲染器,我最好把时间花在允许这样的事情上。 我看到很多人出于各种原因抱怨 d3dx 字体界面,但从来没有链接到更好的支持 unicode 的渲染器...?

  • 使用某些表面格式和/或表面尺寸是否有任何优势(例如,始终使用尽可能小的表面而不是一些标准的大表面,这需要尝试计算尺寸的额外步骤......)

I want to render font in a way that takes account of the current transforms and similar settings, especially the projection transform and viewport.

I'm thinking that the best way to do that is to have an off screen surface to render the text to, and then render that surface where I really want the text.

However I'm not certain on a number of aspects of this solution.

  • Is this the best way to go about it at all?

  • Are there far better free font renderers around that id be better off spending my time with that allow such things. I see alot of people complaining about the d3dx font interfaces for various reasons, but never a link to a better unicode capable renderer...?

  • Is there any advantage to useing certain surface formats and/or surface sizes (eg always using the smallest possible rather than some standard large one, which requires the extra step of trying to work the size out...)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风筝有风,海豚有海 2024-08-01 20:45:50

是的,渲染到纹理,然后绘制纹理四边形来定向和定位文本将是实现此功能的最简单方法。

至于 D3DX 文本渲染器,它实际上取决于您使用的 SDK。 DirectWrite(仅适用于 Windows 7 和 Vista)将为需要以与 Direct3D 互操作的方式呈现高质量文本的应用程序提供更高质量的文本呈现方法。

您当然可以进行自己的光栅化。 有一些开源的字体光栅化引擎可以根据这种需要重新调整用途,但我们在这里讨论大量编码的好处可能不足以区分以保证开发费用。

话虽如此,只要您能够访问作为曲线数据的字形轮廓,就可以使用 Direct3D 和着色器来使用全新的替代方案。 这个想法是使用着色器来光栅化文本并将曲线定义存储在顶点流和关联的纹理中。 尝试查看本文,其中介绍了该技术。

Yeah, render to texture and then drawing a textured quad to orient and position the text is going to be the easiest way to realize this functionality.

As for D3DX text renderers, it really depends on which SDK you are using. DirectWrite (only for Windows 7 and Vista) will provide a higher quality text rendering approach for applications that need high quality text rendering in a manner that is interoperable with Direct3D.

You can of course do your own rasterization. There are font rasterization engines out there that are open source that could be repurposed for this need, but we're talking tons of coding here for a benefit that may not be distinguishable enough to warrant the development expense.

Having said that, there's a completely new alternative available to you with Direct3D and shaders, provided that you have access to the glyph outlines as curve data. The idea is to use the shader to rasterize the text and store the curve definitions in the vertex stream and associated textures. Try looking at this paper, which describes the technique.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文