Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XNA Reach profile

Tags:

xna-4.0

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,

like image 558
NBibodi Avatar asked Mar 19 '26 21:03

NBibodi


1 Answers

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);
like image 131
Empyrean Avatar answered Mar 21 '26 16:03

Empyrean



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!