Using DX8 Sprite as background in a game?

Started by
4 comments, last by Seriema 22 years, 3 months ago
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+{
[ ThumbView: Adds thumbnail support for DDS, PCX, TGA and 16 other imagetypes for Windows XP Explorer. ] [ Chocolate peanuts: Brazilian recipe for home made chocolate covered peanuts. Pure coding pleasure. ]
Advertisement
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.

@+
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.
-Forcaswriteln("Does this actually work?");
Don''t forget the "Voodoo limitation" of 256x256 textures..that''s the max size them family of cards support..

Learn about game programming!Games Programming in C++: Start to Finish
Hold on a sec, what? Who says image sizes have to be a power of 2? Why? Whats the problem with not following that rule?


...go on and live with no regrets, you only have one life...
...go on and live with no regrets, you only have one life...
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
Stay Casual,KenDrunken Hyena

This topic is closed to new replies.

Advertisement