tags:

views:

64

answers:

4

Where should I be looking for resolution of DirectX (3D) device? getViewport seems to have Width and Height, yet as far as I know viewport is supposed to be an area, not 2D "canvas" with these attributes.

(I hope "resolution" applies to the device, not D3D directly. Please correct me if this part is wrong.)

Simple MSDN link will be good answer as well, however I already browsed it through and couldn't find it.

Edit: it seems like getDisplayMode will work for fullscreen apps that changes resolution since it returns the display adapter mode, yet I'd like to be able to get the size of d3d window too.

A: 

Perhaps this is what you need: IDirect3D9::GetAdapterDisplayMode Method

http://msdn.microsoft.com/en-us/library/bb174316%28v=VS.85%29.aspx

Tobias Langner
I'm afraid this also returns the adapter resolution (fullscreen), not just the window size itself.
Mikulas Dite
A: 

If you want the window size then call "GetClientRect" on the hWnd you are setting up with.

Goz
That would be possible, but I only have the D3D interface of the application and nothing else. I'm looking for an answer which uses DirectX to find the size.
Mikulas Dite
+1  A: 

DirectX doesn't actually own a window. If you remember when you initialise the device, you give it a handle to a window. It takes this and displays to its viewports within this window.

So if your looking specifically for the window size then you'll want to get it at the OS level.

This question discusses how to deal with it.

Namely GetWindowRect/GetClientRect(HWND, LPRECT)

JonoRR
+1  A: 

If for some reason you only have the d3d interface, you can use getcreationparameters to get the original hwnd and then you can use GetWindowRect or GetClientRect as suggested before.

D3DDEVICE_CREATION_PARAMETERS cparams;
RECT rect;

device->GetCreationParameters(&cparams);
GetWindowRect(cparams.hFocusWindow, &rect);

//rect.width  
//rect.height
MazarD