Im trying to map pixel data as a byte array to a dynamic texture using direct3d, for some reason the resulting pixel data is black and its not getting transfered. I have converted this code directly from using updatesubresource before, but now im using map/unmap.
ID3D11Texture2D* d3dtex = (ID3D11Texture2D*)textureHandle;
assert(d3dtex);
ID3D11DeviceContext* ctx = NULL;
m_Device->GetImmediateContext(&ctx);
D3D11_MAPPED_SUBRESOURCE mappedResource;
ZeroMemory(&mappedResource, sizeof(D3D11_MAPPED_SUBRESOURCE));
// Disable GPU access to the vertex buffer data.
ctx->Map(d3dtex, 0, D3D11_MAP_WRITE, 0, &mappedResource);
// Update the vertex buffer here.
memcpy(mappedResource.pData, dataPtr, textureWidth * textureHeight * 4);
// Reenable GPU access to the vertex buffer data.
ctx->Unmap(d3dtex, 0);