Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xna game development - Game background issue

Tags:

xna

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.

like image 266
Josema Avatar asked Mar 01 '23 14:03

Josema


2 Answers

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 :-)

like image 70
LaZe Avatar answered Mar 20 '23 19:03

LaZe


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

like image 43
Drithyin Avatar answered Mar 20 '23 19:03

Drithyin