Putting backdrops on Direct3D

Started by
2 comments, last by Magos 18 years, 1 month ago
What's the best way to put big (screen sized) backdrops on 2D games with Direct3D? I'm used to just blitting large images with DirectDraw but read somewhere that some 3D cards won't support textures bigger than 256x256. Mapping a 640x480 texture to a quad works okay on my machine but I'm worried it might fail on other cards. Also seems to massively reduce the number of small sprites I can display in a frame which didn't seem such an issue with DirectDraw. Thanks.
Advertisement
Quote:Original post by EasilyConfused
What's the best way to put big (screen sized) backdrops on 2D games with Direct3D?
I would personally go with the "Screen Aligned Quad" approach. Create a vertex with D3DFVF_XYZRHW and D3DFVF_TEX1 and render it immediately after the Clear() call with no Z-Test/Z-Write.

Quote:Original post by EasilyConfused
I'm used to just blitting large images with DirectDraw but read somewhere that some 3D cards won't support textures bigger than 256x256.
Some very old cards won't - the last popular generation that had such a limit was the Voodoo 3's iirc. Pretty much all decent hardware for the last few years will handle 2048x2048 or larger. Still, it's best to check the device capabilities than to assume anything [smile]

Quote:Original post by EasilyConfused
Mapping a 640x480 texture to a quad works okay on my machine but I'm worried it might fail on other cards.
Write a few fallback methods then - most cards can handle screen-sized textures, some will require 2N dimensions and others just won't handle it full stop. You could just go for a "create it as big as the hardware can" and then scale it up on-the-fly - it'll be blurry/low quality - but it'll work.

Quote:Original post by EasilyConfused
Also seems to massively reduce the number of small sprites I can display in a frame which didn't seem such an issue with DirectDraw.
Without any more details about how you're rendering the background it's difficult to say why this might be. You'll get a performance hit for rendering a large texture (just due to the guaranteed number of frame buffer writes) but it shouldn't hurt too badly.

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Quote:I would personally go with the "Screen Aligned Quad" approach. Create a vertex with D3DFVF_XYZRHW and D3DFVF_TEX1 and render it immediately after the Clear() call with no Z-Test/Z-Write.


Lost me a bit there - bit new to Direct3D and doing everything by messing around with other people's example code I'm afraid. Any good links for some more information on this?

Thanks
Split the image into multiple smaller ones, like:

1024x768 -> 512x512 + 512x512 + 512x256 + 512x256

Then render each one where it should be on the screen (topleft, top right etc...)
----------------------------------------MagosX.com

This topic is closed to new replies.

Advertisement