dk123
dk123

Reputation: 19690

what units are directx viewport values in?

I'm currently working with directx 9. Are the units for the width, height, x, y values of the viewport client rect (screen) coordinates, or backbuffer coordinates?

I'm trying to make sure the aspect ratio of what is displayed on screen matches the initial resolution of the program started (thus either letterboxing or using side bars in case the window ratio and game ratio do not match), but I'm finding difficulty doing so.

Upvotes: 0

Views: 313

Answers (1)

galop1n
galop1n

Reputation: 8824

The view-port is in pixel [(0,0)..(w,h)] and depth is in [0..1] when rendering into a render target of dimensions w and h, backbuffer included.

If your application is windowed, it is up to you to make sure the swapchain resolution match the client rectangle dimensions of your hwnd.

Upvotes: 2

Related Questions