I need to read pixels from a texture, but it just don't work for me.
ID3D11Resource * texture;
D3DX11CreateTextureFromFile(Engine::GetInstance()->GetDevice(),L"./Binary/Media/Textures/height.dds",NULL,NULL,&texture,NULL);
D3D11_MAPPED_SUBRESOURCE mr;
Engine::GetInstance()->GetContext()->Map( texture, 0, D3D11_MAP_READ, 0, &mr);
Engine::GetInstance()->GetContext()->Unmap( texture,0);
After mapping, i am not getting any valid pointer to pixel data, just null in mr variable.
This DDS texture contains one 16bit floating-point channel , which is used as heightmap for a terrain.
What i am doing wrong?
Thank you very much.