Archived

This topic is now archived and is closed to further replies.

Seriema

Using DX8 Sprite as background in a game?

Recommended Posts

Seriema    634
Hi! I''ve downloaded and played around with a Sprite tutorial. Making a small guy walking around a black background I''d like to ad a "real" background, an image (.jpg or .bmp). It would have to be bigger than the screen since I''d like to be able to walk around on it, with scrolling effect (the character in the middle). Is this possible to do with a large Sprite? Any tips on how to achieve this? }+TITANIUM+{

Share this post


Link to post
Share on other sites
jeanmyr    122
hi. With a large sprite, I don''t know. But with a large Direct3D surface, textured with the D3DXCreateTextureFromFileEx() function, I can make this effect. With the A8R8G8B8 format, the result is really acceptable. The D3DXSprites and Direct3D surfaces are fully compatible.

Look at the BumpLens demo in the Direct3D8 tutorials for more informations. This demo use a background picture.

@+

Share this post


Link to post
Share on other sites
Forcas    181
You can sprites bigger than the screen, but remember - the image sizes always have to be powers of 2. Once you go above 1024, it can start to take up mucho memory. I reccomend using tiles at that point.

Share this post


Link to post
Share on other sites
DrunkenHyena    805
G''day!

Textures have to be a power of 2 in size. If you use D3DX to load a non-pow2 texture, it will resize it to be a power of 2 and you will likely get a distorted image.

Why? Because that''s how the hardware works. You can use a non-power of 2 section of a texture by specifying different u,v coordinates, but the texture will be a power of 2. Many cards require that they be square as well.

And yes, to maintain support with Voodoo cards (Voodoo I & II for sure, not sure about 3,4,5) the maximum size is 256x256. And there are still a LOT of Voodoo IIs out there.



Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites