Sign in to follow this  
GreenFuze

Going to Fullscreen: The specified mode is unsupported. CreateDevice/Reset Fails

Recommended Posts

Hey everybody I just wrote my first DirectX window (I got the introduction to 3D Game programming with DirectX9.0c book) after I saw all the recommendations on this book. :-) The application works great on window mode, but when I switch to full screen, I get a DXTrace() error message box. I must say that if I choose not to debug (or running in release), it works perfectly in full-screen. I am getting the following traces: Direct3D9: (ERROR) :The specified mode is unsupported. CreateDevice/Reset Fails Direct3D9: (ERROR) :Unable to set the new mode. CreateDevice/Reset Fails Direct3D9: (ERROR) :Reset failed and Reset/TestCooperativeLevel/Release are the only legal APIs to be called subsequently ---------------------------------- I am performing a CheckDeviceFormat which return S_OK: D3DDISPLAYMODE DisplayMode; md3dObject->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &DisplayMode); HRESULT hr = md3dObject->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DisplayMode.Format, D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, D3DFMT_X8R8G8B8); if( FAILED(hr) ) { MessageBox(NULL,L"EEEEE!",L"Error!",MB_OK); return; } And than I am trying to switch to full-screen: int width = GetSystemMetrics(SM_CXSCREEN); int height = GetSystemMetrics(SM_CYSCREEN); md3dPP.BackBufferFormat = D3DFMT_X8R8G8B8; md3dPP.BackBufferWidth = width; md3dPP.BackBufferHeight = height; md3dPP.Windowed = false; md3dPP.hDeviceWindow = mhMainWnd; SetWindowLongPtr(mhMainWnd, GWL_style, WS_POPUP); SetWindowPos(mhMainWnd, HWND_TOP, 0, 0, width, height, SWP_NOZORDER | SWP_SHOWWINDOW); ------------------------------------- The actual error returns when I am trying to reset the device in the WNDPROC: case WM_SIZE: md3dPP.BackBufferWidth = LOWORD(lParam); md3dPP.BackBufferHeight = HIWORD(lParam); onLostDevice(); hr = gd3dDevice->Reset(&md3dPP); // <-- HERE!!! if(hr != S_OK){ /*DXTrace code*/ } onResetDevice(); return 0; -------------------------------------- Can anyone point out what am I doing wrong ?!?!?! I'm really stuck with it :-( . Thanks a lot in advance!

Share this post


Link to post
Share on other sites
Hey, here is an update on what might cause the problem (but I still don't understand why it happens):

In the code:

case WM_SIZE:
md3dPP.BackBufferWidth = LOWORD(lParam);
md3dPP.BackBufferHeight = HIWORD(lParam);
onLostDevice();
hr = gd3dDevice->Reset(&md3dPP); // <-- HERE!!!
if(hr != S_OK){ /*DXTrace code*/ }
onResetDevice();
return 0;


The line "LOWORD(lParam)" return 900,
The line "HIWORD(lParam)" return 700,
While my full screen resolution is 1280x1024.

I put those lines in remark, and everything went smoothly (even resizing the window).

So I must admit I am a bit confused on, why do I need these lines?!


Thanks again!

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