//If you need any help, leave a message.
HRESULT hr = S_OK;
// Setup the render target texture description.
D3D11_TEXTURE2D_DESC rtTextureDesc;
rtTextureDesc.Width = 1280;
rtTextureDesc.Height = 960;
rtTextureDesc.MipLevels = 1;
rtTextureDesc.ArraySize = 1;
rtTextureDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
rtTextureDesc.SampleDesc.Count = 1;
rtTextureDesc.SampleDesc.Quality = 0;
rtTextureDesc.Usage = D3D11_USAGE_DEFAULT;
rtTextureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
rtTextureDesc.CPUAccessFlags = 0;
rtTextureDesc.MiscFlags = 0;
// Create the render target texture.
V_RETURN(pd3dDevice->CreateTexture2D(&rtTextureDesc, NULL, &m_renderTargetTexture));
// Setup the description of the render target view.
D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc;
renderTargetViewDesc.Format = rtTextureDesc.Format;
renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
renderTargetViewDesc.Texture2D.MipSlice = 0;
// Create the render target view.
V_RETURN(pd3dDevice->CreateRenderTargetView(m_renderTargetTexture, &renderTargetViewDesc, &m_renderTargetView));
//Setup the depth stencil texture description.
D3D11_TEXTURE2D_DESC dsTextureDesc;
dsTextureDesc.Width = 1024;
dsTextureDesc.Height = 1024;
dsTextureDesc.MipLevels = 1;
dsTextureDesc.ArraySize = 1;
dsTextureDesc.SampleDesc.Count = 1;
dsTextureDesc.SampleDesc.Quality = 0;
dsTextureDesc.Format = DXGI_FORMAT_D32_FLOAT;
dsTextureDesc.Usage = D3D11_USAGE_DEFAULT;
dsTextureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
dsTextureDesc.CPUAccessFlags = 0;
dsTextureDesc.MiscFlags = 0;
V_RETURN(pd3dDevice->CreateTexture2D(&dsTextureDesc, NULL, &m_depthTexture));
// Create the depth stencil view
D3D11_DEPTH_STENCIL_VIEW_DESC DescDS;
DescDS.Format = dsTextureDesc.Format;
DescDS.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
DescDS.Texture2D.MipSlice = 0;
DescDS.Flags = NULL;
V_RETURN(pd3dDevice->CreateDepthStencilView(m_depthTexture, &DescDS, &m_depthView));
pd3dImmediateContext->OMSetRenderTargets(1, &m_renderTargetView, m_depthView);
return hr;
'Cat.Storage > SubCat.Practice' 카테고리의 다른 글
[Directx12] 2. Anatomy of the sample code (1) | 2017.04.14 |
---|---|
[Directx12] 1. Settings (0) | 2017.04.13 |
[Matlab] Define 2D sinc() function (0) | 2016.09.21 |
C++ binary read/write sample (0) | 2016.03.15 |
Magnitude and Phase Information of the FFT (0) | 2015.10.10 |