Sign in to follow this  
azherdev

[MDX] Direct3D background bitmap possible?

Recommended Posts

azherdev    112
What is the best way to put a background image with Managed D3D? I am making a windowed game with mdx, now I need to add a background to the window... how? Bunch of sprites? Window can be resized and I would like to have the background image to scale to fit. Thanks.

Share this post


Link to post
Share on other sites
hplus0603    11347
The easiest way to do it is to draw the image as a texture, and to send in pre-transformed vertices (XYZRHW) in a triangle fan (four vertices for a rectangle), textured with that image.

Share this post


Link to post
Share on other sites
azherdev    112
Yes, I thought of that. But what does that mean? Loading a 512x512 image, or 1024x1024? and stretching it? I was just wondering if there was a "clear" method that would clear the device with an image rather than a color. Sigh... I remember the good ol' 2D days... :(

Share this post


Link to post
Share on other sites
ViLiO    1326
The image wouldn't need to be a power of two as you wouldn't need mipmapping. The common approach for a single large background image would be to just load an image (say 800x600 jpg) and apply it to a pre-transformed quad (as hplus0603 said). You would also disable the zbuffer before drawing the quad and then enable it again afterwards (this would be for drawing the background first and having everything else drawn later be drawn over it).

Regards,
ViLiO

Share this post


Link to post
Share on other sites
azherdev    112
Hmm, so loading the 800x600 texture without mipmap or other features will not force it to resize? Ok, I'll try it. I am just scared of compatibility issues with some video card. Ok, thanks for the info.

BTW ViLiO, I love that Rygar icon... brings back lots of good memories. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this