Ok so I'm making a 2D game set in space and I want a tiled background of stars. I've got the texture which will just repeat forever in the background.
Would the best way to achieve this be to just use a sprite interface to draw several copies of the texture to the background until it is covered or is there a simpler way?
If it's the former then I already know how to do this, I just wanted to know if there's an easier way. I'm only familiar with using sprites in directx just now, just wondering if covering the screen in sprites would be the best way.
Thanks.
Repeated tiled background in 2D games (directX)
Started by poita, May 02 2006 09:50 AM
3 replies to this topic
#1
Posted 02 May 2006 - 09:50 AM
#2
Posted 02 May 2006 - 11:44 AM
It should be more sufficient to have one sprite (one quad). Then repeat the texture on it instead of having several sprites.
Texture uv-coordinates (0,0) to (1,1) would render the texture once. If you set the uv-coordinates to e.g. (0,0) to (10,10) then you should be rendering the texture tiled 10 times on one sprite. Be sure to set the right clamp mode...
Texture uv-coordinates (0,0) to (1,1) would render the texture once. If you set the uv-coordinates to e.g. (0,0) to (10,10) then you should be rendering the texture tiled 10 times on one sprite. Be sure to set the right clamp mode...
#3
Posted 02 May 2006 - 01:47 PM
How can I set UV coordinates on a sprite? I'm using ID3DXSprite btw.
#4
Posted 02 May 2006 - 02:39 PM
Oops, you are talking about sprites…
I would recommend using quads (two triangles) instead since using sprites is deprecated. Then you just have a vertex buffer and you set the uv-coordinates for your vertices.
I would recommend using quads (two triangles) instead since using sprites is deprecated. Then you just have a vertex buffer and you set the uv-coordinates for your vertices.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












