Draw a rectangle with texture (VertexPositionTexture) in Xna 3d

StackOverflow https://stackoverflow.com/questions/23298791

  •  09-07-2023
  •  | 
  •  

Вопрос

I am tryig to draw a rectangle with texture using VertexPositionTexture but I get an error:

An unhandled exception of type 'System.NotSupportedException' occurred in Microsoft.Xna.Framework.Graphics.dll

Additional information: XNA Framework Reach profile requires TextureAddressMode to be Clamp when using texture sizes that are not powers of two.

Thanks.

Это было полезно?

Решение

Three options:

(1) Try adding this line:

GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp;

This may change the appearance of the texture.

(2)

Change the height and width of the texture such that height * width is a power of 2. (i.e. ((2^9) * (2^9)) = 512*512 = 2^18)

(3) Change the XNA profile from Reach to Hi-def.

Right-click your project in Solution Explorer
Choose Properties
Focus the XNA Game Studio tab, and make your selection

(http://blogs.msdn.com/b/shawnhar/archive/2010/07/19/selecting-reach-vs-hidef.aspx)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top