Creating full screen DirectX device causes D3DERR_INVALIDCALL
Asked Answered
R

1

1

I'm trying to create a DirectX device in full screen (up until this point in time I've been doign windowed), but the device won't get created and I get an invalid call HR fail.

This is my code:

    md3dPP.BackBufferWidth            = 1280; 
md3dPP.BackBufferHeight           = 720;
md3dPP.BackBufferFormat           = D3DFMT_UNKNOWN;
md3dPP.BackBufferCount            = 1;
md3dPP.MultiSampleType            = D3DMULTISAMPLE_NONE;
md3dPP.MultiSampleQuality         = 0;
md3dPP.SwapEffect                 = D3DSWAPEFFECT_DISCARD; 
md3dPP.hDeviceWindow              = mhMainWnd;
md3dPP.Windowed                   = false;
md3dPP.EnableAutoDepthStencil     = true; 
md3dPP.AutoDepthStencilFormat     = D3DFMT_D24S8;
md3dPP.Flags                      = 0;
md3dPP.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
md3dPP.PresentationInterval       = D3DPRESENT_INTERVAL_IMMEDIATE;


HR(md3dObject->CreateDevice(
    D3DADAPTER_DEFAULT, // primary adapter
    mDevType,           // device type
    mhMainWnd,          // window associated with device
    devBehaviorFlags,   // vertex processing
    &md3dPP,            // present parameters
    &m_pd3dDevice));    // return created device

Notice 'md3dPP.Windowed = false;', if that's true the device creates in windowed mode.

I'm under the impression I've made a mistake in some of my default values but have no idea where to look. Is there a way to get a more detailed report as to why the device creation failed beyond D3DERR_INVALIDCALL?

Reina answered 2/11, 2010 at 4:37 Comment(0)
G
4

You need to specify a different value for BackBufferFormat because only windowed apps allow the value D3DFMT_UNKNOWN. Pick one that is supported by your device (you can check by using CheckDeviceFormat()).

Glutton answered 2/11, 2010 at 5:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.