0

I'm now writing a game on WP7 using XNA Framework 4.0.

There are some pictures that needs to be tiled.

So I set the SamplerState[0] to LinearWrap before rendering these pictures and I switch it back to LinearClamp once done.

However, the game still throws exceptions when it has finished all the tiled pictures and is about to create a VertexBuffer for the first non-tiled (i.e. not wrapped) picture.

I've added a breakpoint at that line and has confirmed that GraphicsDevice's Samplerstates[0] is LinearClamp. All other 15 SamplerStates are LinearWrap but I'm not using any multi-texture features so I don't think it's the reason. (frankly, I don't even know how to use multi-texture in XNA, maybe DualTextureEffect?)

BTW, I've desperately set all 16 samplers to LinearClamp, but the problem still occurs.

Anyone has encountered similar problems or has any solution?

alfah
  • 2,077
  • 1
  • 31
  • 55
HoneyFox
  • 28
  • 5
  • 1
    In addition to the above, can you post a snippet of the code that's responsible for drawing the tiled images? – Cole Campbell Jul 25 '12 at 20:56
  • @Blau: A NotSupportedException with message of: XNA Framework Reach profile requires TextureAddressMode to be Clamp when using texture sizes that are not powers of two. – HoneyFox Jul 31 '12 at 08:56
  • @ColeCampbell: Sorry i don't have the code now. But I do have set up the SamplerState[0] to LinearClamp. – HoneyFox Jul 31 '12 at 08:59
  • Why don't use texture with power of two size? go to the content project, select the texture, open de processor, set resize to power of two to true... – Blau Jul 31 '12 at 10:25
  • @Blau: will try that. I thought it would cause some quality loss though. But if it's acceptable that's OK. – HoneyFox Aug 01 '12 at 02:20

1 Answers1

0

@Blau had it in his comment. Simply select the images you're using, open the properties window, expand Content Processor, and switch "Resize to a power of two" to true.

Plato
  • 13
  • 5