Original Post
Hi, I'm using SlimDX in combination with DX10 and I'm trying to write a Terrain class, therefore I need access to the heightmap data of the texture. In XNA it was easy, but in SlimDX it seems more difficult... I tried this:
//Constructor
public Terrain(Device device, string heightMapAsset) {
Texture2D tex = Texture2D.FromFile(device, heightMapAsset);
heightData = new float[tex.Description.Width, tex.Description.Height];
//Exception in this line:
DataRectangle data = tex.Map(0, MapMode.WriteDiscard, MapFlags.None);
}
But it doesn't work...I get: E_INVALIDARG: An invalid parameter was passed to the returning function (-2147024809) In the DX SDK Docu it says that I should call D3D10CalcSubresource() for the first argument...but where is the function in slimdx?? By the way, are there any tutorials for DX10 with SlimDX available?