Xna game development - problem with the game

Im starting with XNA and I need advice on the following.

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

width: 5000px height: 4800px 

When I try to load a texture, I get the following error:

The width or height of the texture is greater than the device supports

What is the most used technique for moving the background while moving your ship?

Thank you very much.

Sincerely.

Josema.

+4
source share
3 answers

One way is to separate your image from smaller fragments and draw visible ones.

However, this method suffers from a problem when bilinear sampling is used because the colors bleed from one side of the texture to the other. You can probably compensate by disabling WRAP texture fetching or by capturing one pixel from the tiles next to.

For example, if you want a texture of size 256x256, you will only display 255x255 fragments, because one line (right and bottom) is a copy of the tiles next to it.

Hope this makes sense, otherwise I will have to paint a picture :-)

+7
source

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

Try something like this. It builds a simple 40x40, but you can use it as a guide on how to tile your own. http://forums.xna.com/forums/p/19835/103704.aspx

+1
source

To move the background simultaneously with the movement of your ship, you can implement a camera.

The following links may help -

http://adambruenderman.wordpress.com/2011/04/05/create-a-2d-camera-in-xna-gs-4-0/ http://www.dreamincode.net/forums/topic/237979- 2d-camera-in-xna /

0
source

Source: https://habr.com/ru/post/1286620/


All Articles