Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

WinRT: added code to update the main texture on each frame with dummy…

… data
  • Loading branch information
DavidLudwig committed Nov 21, 2012
1 parent 669e347 commit 782ccaa753fedbc0d2629a030517d69fe803d012
Showing with 24 additions and 0 deletions.
  1. +24 −0 src/video/windowsrt/SDL_winrtrenderer.cpp
@@ -178,6 +178,30 @@ void SDL_winrtrenderer::Render()
return;
}

// Update the main texture (for SDL usage):
D3D11_MAPPED_SUBRESOURCE textureMemory = {0};
DX::ThrowIfFailed(
m_d3dContext->Map(
m_mainTexture.Get(),
0,
D3D11_MAP_WRITE_DISCARD,
0,
&textureMemory)
);

const int max = (int)m_windowBounds.Width * (int)m_windowBounds.Height * 4;
uint8 * buf = (uint8 *)textureMemory.pData;
for (int i = 0; i < max; i += 4) {
buf[i+0] = 0x00;
buf[i+1] = 0xFF;
buf[i+2] = 0x00;
buf[i+3] = 0xFF;
}

m_d3dContext->Unmap(
m_mainTexture.Get(),
0);

m_d3dContext->OMSetRenderTargets(
1,
m_renderTargetView.GetAddressOf(),

0 comments on commit 782ccaa

Please sign in to comment.