I am trying to load volume from file of type raw with given dimensions which are specified higher in code( mWidth, mHeight, mDepth). I want to use Volume.FromFileInMemory
method. This is piece of the code which should do the loading.
Volume volume = new Volume(IntPtr.Zero);
BinaryReader reader = new BinaryReader(file);
byte[] buffer = new byte[mWidth * mHeight * mDepth];
int size = sizeof(byte);
reader.Read(buffer, 0, size * buffer.Length);
Volume.FromFileInMemory(volume,buffer,Filter.None,0);
reader.Close();
However when I execute the code I get an weird exception which I don't really understand.
An unhandled exception of type 'SharpDX.SharpDXException' occurred in SharpDX.dll
Additional information: HRESULT: [0x8876086C], Module: [SharpDX.Direct3D9], ApiCode: [D3DERR_INVALIDCALL/InvalidCall], Message: Unknown
I read the documentaion for the FileInMemory
method and googled for a while but I really can't solve this issue.