当前位置: 首页>>代码示例>>C++>>正文


C++ IDXGISwapChain::ResizeBuffers方法代码示例

本文整理汇总了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;
    }
开发者ID:Erowlin,项目名称:OBS,代码行数:19,代码来源:D3D11Capture.cpp

示例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;
};
开发者ID:dgadens,项目名称:ActionEngine,代码行数:72,代码来源:ACD3D.cpp

示例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);
}
开发者ID:is00hcw,项目名称:apitrace,代码行数:4,代码来源:d3dretrace_dxgi.hpp


注:本文中的IDXGISwapChain::ResizeBuffers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。