Advertisement Jump to content
Sign in to follow this  
TheUmpteenth

CreateDevice failure

This topic is 4243 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

Umm, apologies for the duplicate post (put this on in the newbie section, but without much luck :( Thanks for not noticing ;p ) OK, Firstly, Hi, I'm new here. I'm not a C++ noob, or a DirectX noob, but I'm having a noob problem :) the problem is that if I set the D3DPRESENT_PARAMETERS' Windowed flag to FALSE, CreateDevice() fails. I can't see why. I'm not too great at posting on a forum, so here's the code as best as i can manage... D3DPRESENT_PARAMETERS dx_PresParams; ZeroMemory( &dx_PresParams, sizeof(dx_PresParams) ); dx_PresParams.Windowed = FALSE; dx_PresParams.FullScreen_RefreshRateInHz= D3DPRESENT_RATE_DEFAULT; dx_PresParams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; dx_PresParams.BackBufferCount = 1; dx_PresParams.BackBufferFormat = D3DFMT_UNKNOWN; dx_PresParams.BackBufferHeight = Wind.GetHeight(); dx_PresParams.BackBufferWidth = Wind.GetWidth(); dx_PresParams.SwapEffect = D3DSWAPEFFECT_DISCARD; if (FAILED(m_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Wind.GetHWnd(), D3DCREATE_HARDWARE_VERTEXPROCESSING, &dx_PresParams, &m_pDxDev))) { if (FAILED(m_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, Wind.GetHWnd(), D3DCREATE_SOFTWARE_VERTEXPROCESSING, &dx_PresParams, &m_pDxDev))) { MessageBox(Wind.GetHWnd(),"Failed to create even the reference device!", "FATAL ERROR!",MB_OK|MB_ICONEXCLAMATION); }else{ MessageBox(Wind.GetHWnd(),"working with the reference device!", "Problems",MB_OK); } } btw, it's the "Failed to create even the reference device!" message I get [Edited by - LessBread on June 13, 2007 2:39:08 PM]

Share this post


Link to post
Share on other sites
Advertisement
Yeh, Worked well, thanks.

Here, for those who might have a similar problem, is the fixed code snippet.

D3DDISPLAYMODE d3ddm;
m_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm);

D3DPRESENT_PARAMETERS dx_PresParams;

ZeroMemory( &dx_PresParams, sizeof(dx_PresParams) );

dx_PresParams.Windowed = FALSE;
dx_PresParams.FullScreen_RefreshRateInHz = d3ddm.RefreshRate;
dx_PresParams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
dx_PresParams.BackBufferCount = 1;
dx_PresParams.BackBufferFormat = d3ddm.Format;
dx_PresParams.BackBufferHeight = Wind.GetHeight();
dx_PresParams.BackBufferWidth = Wind.GetWidth();
dx_PresParams.SwapEffect = D3DSWAPEFFECT_DISCARD;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!