XNA 达到简介

发布于 2024-10-31 11:58:17 字数 290 浏览 0 评论 0原文

我收到他的错误

“当使用不是 2 的幂的纹理大小时,XNA Framework Reach 配置文件需要将 TextureAddressMode 限制为 Clamp”行,

GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
                    (PrimitiveType.TriangleStrip, verts, 0, 2);

应该做什么?

谢谢,

I get his error

"XNA Framework Reach profile requires TextureAddressMode to be Clamp when using texture sizes that are not powers of two"

for line

GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
                    (PrimitiveType.TriangleStrip, verts, 0, 2);

What should I do ?

Thanks,

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

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

发布评论

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

评论(2

云淡风轻 2024-11-07 11:58:17

使用到达配置文件时,请使用两种尺寸纹理的幂或将“TextureAddressingMode”设置为“Clamp”。

TextureAddressingMode 是 GraphicsDevice SamplerState 的一部分。您需要在绘制调用之前设置此状态。以下代码显示如何将第一个纹理采样器设置为内置采样器状态之一。

GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp;

GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
                    (PrimitiveType.TriangleStrip, verts, 0, 2);

When using a reach profile, use power of two sized textures or set the TextureAddressingMode to Clamp.

The TextureAddressingMode is part of the GraphicsDevice SamplerState. You need to set this state before your draw call. The following code shows how to set the first texture sampler to one of the built in sampler states.

GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp;

GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>
                    (PrimitiveType.TriangleStrip, verts, 0, 2);
心如荒岛 2024-11-07 11:58:17

就我而言,Model.fx 文件将 AddressMode 设置为 Wrap,这把事情弄乱了。

这是我的 Model.fx 中的正确的sampler_state:

sampler TextureSampler = sampler_state
{
    Texture = (Texture);

    MinFilter = Linear;
    MagFilter = Linear;
    MipFilter = Linear;

    AddressU = Clamp;
    AddressV = Clamp;
};

可以在此处找到更多信息:http://www. packtpub.com/article/xna-hsl

I my case, the Model.fx file was setting the AddressMode to Wrap and that was messing it up.

Here's the correct sampler_state from my Model.fx:

sampler TextureSampler = sampler_state
{
    Texture = (Texture);

    MinFilter = Linear;
    MagFilter = Linear;
    MipFilter = Linear;

    AddressU = Clamp;
    AddressV = Clamp;
};

More info can be found here: http://www.packtpub.com/article/xna-hsl

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