views:

454

answers:

2

Hi,

Im starting with XNA and i need an advice about the following.

I have a .jpg file with my space ship game background with the following size:

   width:  5000px 

   height: 4800px

When i try to load the texture i get the following error:

Texture width or height is larger than the device supports

What is the most used technique to move the background at the same time that your ship is moving?

Thanks a lot.

Kind Regards.

Josema.

+4  A: 

One way would be to separate your image into smaller tiles and draw the visible ones.

However this technique suffers from a problem when bilinear sampling is used, because the colors bleeds from the one side of the texture to the other. You can probably compensate by disabling texture WRAP sampling or by grabbing a single of pixels from the tiles next to.

For example if you want 256x256 textures, you would only display 255x255 tiles, because one line (right and bottom) is a copy from the tiles next to it.

Hope it makes sense, otherwise I'll have to paint a picture :-)

LaZe
Thanks a lot Laze. Very helpful
Josema
+1  A: 

The texture limit is determined by graphics card, I believe. You want to break the texture down to smaller images.

Try something like this. He's tiling a simple 40x40, but you might use it a a guideline on how to tile yours. http://forums.xna.com/forums/p/19835/103704.aspx

Drithyin