Sign in to follow this  

DirectX - Window Size and BackBuffer Size

This topic is 2959 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all So I'm using DirectX 9 and C++, with a windowed app. I'm wondering how you can create (or set the size of) the window based on what size you want the backbuffer or client area to be. So for example, if I set the size of the window when I create it to 500x500, then the whole window is that size. The actual drawing area is smaller, as there is a menu at the top, and a border around the window. Also, with different Windows themes, the size of the menu and border can change... So my question is: Can you get the window to automatically resize to fit a client area of exactly 500x500 pixels? Thanks!

Share this post


Link to post
Share on other sites
In general yes. It's been supported forever. It's the most common format used for backbuffers and uncompressed textures. You can use X8R8G8B8 without checking for support, as everything made since the mid-90s will support it.

Only a few formats are available for backbuffers, so your options are limited.

There is generally no reason to use a 16-bit backbuffer these days, so let's just ignore those.

There is some support for A2R10G10B10 buffers, but you'd want to have code to fall back on X8R8G8B8 when a card doesn't support it. The extra few bits don't make enough of a difference to be worth handling two formats.

A8R8G8B8 is the same as the X8R8G8B8, except it allows you to store alpha values in your backbuffer. One pass can write an alpha value, and a subsequent pass can use D3DBLEND_DESTALPHA / INVDESTALPHA to blend based on that alpha value. It's useful on rare occasions. One caveat about this format is when calling CheckDeviceFormat or CheckDepthStencilMatch, you must pass in X8R8G8B8 as the 'adapter' format, while passing A8R8G8B8 as the rendertarget format.

Share this post


Link to post
Share on other sites

This topic is 2959 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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