本文整理汇总了C++中IDXGISwapChain::ResizeBuffers方法的典型用法代码示例。如果您正苦于以下问题:C++ IDXGISwapChain::ResizeBuffers方法的具体用法?C++ IDXGISwapChain::ResizeBuffers怎么用?C++ IDXGISwapChain::ResizeBuffers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDXGISwapChain
的用法示例。
在下文中一共展示了IDXGISwapChain::ResizeBuffers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SwapResizeBuffersHook
HRESULT STDMETHODCALLTYPE SwapResizeBuffersHook(UINT bufferCount, UINT width, UINT height, DXGI_FORMAT giFormat, UINT flags)
{
IDXGISwapChain *swap = (IDXGISwapChain*)this;
gi11swapResizeBuffers.Unhook();
HRESULT hRes = swap->ResizeBuffers(bufferCount, width, height, giFormat, flags);
gi11swapResizeBuffers.Rehook();
if(lpCurrentSwap == NULL && !bTargetAcquired)
{
lpCurrentSwap = swap;
bTargetAcquired = true;
}
if(lpCurrentSwap == swap)
SetupD3D11(swap);
return hRes;
}
示例2: Resize
HRESULT ACD3D::Resize(UINT width, UINT height)
{
HRESULT hr;
//mata o anterior
SAFE_RELEASE(mpVpComponents[mActiveWnd]->pRenderTargetView);
SAFE_RELEASE(mpVpComponents[mActiveWnd]->pDepthStencilView);
#pragma region RESIZE BACKBUFFER
IDXGISwapChain* pSwapChain = mpVpComponents[mActiveWnd]->pSwapChain;
hr = pSwapChain->ResizeBuffers(1, width, height, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH);
if( FAILED( hr ) )
{
MessageBoxA(nullptr, "[ERROR] ResizeBuffer. Resize()", "Error", MB_OK | MB_ICONERROR);
return hr;
}
#pragma endregion
#pragma region CREATE RENDERTARGETVIEW
//array de backbuffers, um pra cada janela
ID3D11Texture2D* pBackBuffer;
ID3D11RenderTargetView* pRenderTargetView;
hr = pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), ( LPVOID* )&pBackBuffer );
if( FAILED( hr ) )
{
MessageBoxA(nullptr, "[ERROR] Create Buffer. Resize()", "Error", MB_OK | MB_ICONERROR);
return hr;
}
hr = ACD3DGlobals::G_pD3dDevice->CreateRenderTargetView( pBackBuffer, nullptr, &pRenderTargetView );
if( FAILED( hr ) )
{
MessageBoxA(nullptr, "[ERROR] Create render target view. Resize()", "Error", MB_OK | MB_ICONERROR);
return hr;
}
mpVpComponents[mActiveWnd]->pRenderTargetView = pRenderTargetView;
pBackBuffer->Release();
#pragma endregion
#pragma region CREATE DEPTHSTENCILVIEW
//cria outro com as novas configuracoes
ID3D11Texture2D* pDepthStencil;
ID3D11DepthStencilView* pDepthStencilView;
//define o stencil view
hr = ACD3DConfigurations::DefineDepthStencilView(ACD3DGlobals::G_pD3dDevice,
&pDepthStencil, &pDepthStencilView,
width, height);
if( FAILED( hr ) )
{
MessageBoxA(nullptr, "[ERROR] Create depth stencil view. Resize()", "Error", MB_OK | MB_ICONERROR);
return hr;
}
mpVpComponents[mActiveWnd]->pDepthStencilView = pDepthStencilView;
pDepthStencil->Release();
#pragma endregion
#pragma region RESIZE VIEWPORT
mpVpComponents[mActiveWnd]->Viewport.Width = width;
mpVpComponents[mActiveWnd]->Viewport.Height = height;
#pragma endregion
//seta a viewport
ACD3DGlobals::G_pContext->RSSetViewports( 1, &mpVpComponents[mActiveWnd]->Viewport );
//seta o render target e o depthstencil
ACD3DGlobals::G_pContext->OMSetRenderTargets( 1, &pRenderTargetView, pDepthStencilView );
return AC_OK;
};
示例3: ResizeBuffers
HRESULT STDMETHODCALLTYPE CDXGISwapChainDWM::ResizeBuffers(UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
{
return m_pSwapChain->ResizeBuffers(BufferCount, Width, Height, NewFormat, SwapChainFlags);
}