How to: get an adapter display mode (h)

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/xiaoyafang123/article/details/89498988

DirectX 10 and 11 to obtain an effective display mode associated with the adapter using DirectX graphics infrastructure (DXGI). Learn valid display mode ensures that an application can properly select an effective full-screen mode.

How to get an adapter display mode

  1. Creating IDXGIFactory object and use it enumerates available adapters. For more information, see How to: enumerate adapter .
  2. Call IDXGIAdapter :: EnumOutputs enumeration of the output of each adapter.
    
    IDXGIOutput* pOutput = NULL; 
    HRESULT hr;
    
    hr = pAdapter->EnumOutputs(0,&pOutput);
    
    

     

  3. IDXGIOutput :: GetDisplayModeList call to retrieve the number of elements in the array and the array of DXGI_MODE_DESC structure. Each DXGI_MODE_DESC structure represents an effective output display mode.
    UINT numModes = 0;
    DXGI_MODE_DESC* displayModes = NULL;
    DXGI_FORMAT format = DXGI_FORMAT_R32G32B32A32_FLOAT;
    
        // Get the number of elements
        hr = pOutput->GetDisplayModeList( format, 0, &numModes, NULL);
    
        displayModes = new DXGI_MODE_DESC[numModes]; 
    
        // Get the list
        hr = pOutput->GetDisplayModeList( format, 0, &numModes, displayModes);
    

     

 

Guess you like

Origin blog.csdn.net/xiaoyafang123/article/details/89498988