I can display a textured quad by using D3D11 & DirectXTex's ScratchImage and CreateShaderResourceView. How would I be able to render this texture to another one similarly created? I know that I need to create a RenderTargetView and use Map somehow but I don't know how it all fits together I'm quite mixed up. I have studied Braynzarsoft's Tutorial 34 How to Render to Texture but I couldn't congeal the information into a logical form of understanding. Plus the registration doesn't work and can't download the source code. Finally should I actually just use DirectX::CopyRectangle or is it too slow? In good faith here is how I create the texture:
m_spTexture.reset(new ScratchImage);
WCHAR wcExt[_MAX_EXT];
_wsplitpath_s(wsFilename.c_str(), nullptr, 0, nullptr, 0, nullptr, 0, wcExt, _MAX_EXT);
HRESULT hr;
if ( _wcsicmp(wcExt, L".dds") == 0)
{
hr = LoadFromDDSFile(wsFilename.c_str(), DDS_FLAGS_NONE, &m_stInfo, *m_spTexture);
}
else if (_wcsicmp(wcExt, L".tga") == 0)
{
hr = LoadFromTGAFile(wsFilename.c_str(), &m_stInfo, *m_spTexture);
}
else
{
hr = LoadFromWICFile(wsFilename.c_str(), WIC_FLAGS_NONE, &m_stInfo, *m_spTexture);
}
if (SUCCEEDED(hr))
{
hr = CreateShaderResourceView(g_pEngine->GetD3DObj()->m_spD3DDevice.Get(),
m_spTexture->GetImages(),
m_spTexture->GetImageCount(),
m_stInfo,
m_spSRV.GetAddressOf() );
if (FAILED(hr))
return hr;
}
return hr;
I look forward to and appreciate your thoughts.
ID3D11Device::CopyResourcebut I suspect you actually want more than that, especially since you refer to rendering to the texture. \$\endgroup\$