I've read up on the theory/reasoning behind a swap chain in Graphics. Everywhere I've read, they talk about pointers to the front and backbuffer(s) which are swapped instead of actual data exchange. My question is, where exactly can we see this swapping? is it in some function? is it automatic? if it's automatic, where do we get the pointer to the other buffer?
If we look at this code from Rastertek for instance, m_renderTargetView always seems to point to the same buffer throughout the execution of the code :
result = m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBufferPtr);
if(FAILED(result))
{
return false;
}
// Create the render target view with the back buffer pointer.
result = m_device->CreateRenderTargetView(backBufferPtr, NULL, &m_renderTargetView);
if(FAILED(result))
{
return false;
}
backBufferPtr->Release();
backBufferPtr = 0;