在某些机器上,当线宽为 1.0 时,ID3DXLine 出现奇怪的行为

发布于 2024-12-26 11:27:47 字数 634 浏览 3 评论 0原文

我现在在几台机器上遇到了这个问题 - 几乎总是笔记本电脑,我认为通常是那些配备英特尔图形芯片组的机器,当使用 ID3DXLine 时。

我有一些代码看起来像这样:

MyLine->SetWidth(MyLineThickness);
MyLine->SetPattern(MyLinePattern);
MyLine->Begin();
{   
    ... Draw some lines with ->MyLine->Draw
}               
MyLine->End();

MyLine 是 CComPtr (ID3DXLine)。当 MyLineThickness 为 1.0 时,这些机器会绘制粗线(看起来就像是用毡尖笔绘制的!)。当我将 MyLineThickness 更改为 1.1 或 1.5 时,我会得到漂亮的细线。显然,将其增加到 8.f 左右会再次出现粗线。

因此,当厚度为 1.0 时,这些机器上的 ID3DXLine 似乎会做一些非常奇怪的事情。在< 1.f和> 1.f 它的行为似乎正如您所期望的!

还有其他人在 ID3DXLine 中遇到过任何奇怪的情况吗?顺便说一句,我正在使用 D3D 9.0c 以及 2010 年 2 月的 SDK。

I've had this problem on a couple of machines now - almost always laptops and I think usually those with Intel graphics chipsets, when using ID3DXLine.

I have some code that vaguely looks like this:

MyLine->SetWidth(MyLineThickness);
MyLine->SetPattern(MyLinePattern);
MyLine->Begin();
{   
    ... Draw some lines with ->MyLine->Draw
}               
MyLine->End();

With MyLine being a CComPtr (ID3DXLine). When MyLineThickness is 1.0, these machines draw thick lines (looking as if they're drawn with a felt-tip pen!). When I change MyLineThickness to 1.1, or 1.5, I then get nice thin lines. Obviously increasing that to around 8.f will give me thick lines again.

So ID3DXLine on these machines seems to do something really odd when thickness is 1.0. At < 1.f and > 1.f it seems to behave as you would expect!

Has anyone else experienced any strangeness in ID3DXLine? I'm using D3D 9.0c btw, alongside the Feb 2010 SDK.

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

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

发布评论

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

评论(1

酒废 2025-01-02 11:27:47

根据 DX9 文档,粗细为 1.0f 的线条是使用本机硬件线条绘制支持(如果存在)绘制的。所有其他尺寸都是通过生成一对三角形来绘制的,因此通过顶点着色器进行渲染。尝试检查 D3DCAPS9::LineCaps 以获取支持的功能。

在玩了一些 ID3DXLine 之后,我决定使用 DrawPrimitives 来绘制线条 - 它可能会慢一点,但至少在任何系统上都能得到相同的结果。

According to DX9 documentation lines of thickness 1.0f are drawn using native hardware line drawing support if one exists. All other sizes are drawn by producing a pair of triangles and, hence, rendered via vertex shader. Try checking D3DCAPS9::LineCaps for supported capabilities.

After some playing with ID3DXLine I decided to use DrawPrimitives for drawing lines - it's probably a bit slower but at least you get same result on any system.

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