問題描述
ID3DX10Mesh::CloneMesh (ID3DX10Mesh::CloneMesh)
I'm trying to copy mesh in DirectX10. I wrote this:
HR(mesh‑>CloneMesh(mesh‑>GetFlags(),data.GetPosSemantic(),data.GetInputElementDesc(),
data.GetDescCount(),&mMesh));
but when i try to render the mesh nothing appers on the screen.
when i write
mMesh = mesh;
There are no problems with the rendering(unless when I release "mesh" ).
Thanks in advance.
‑‑‑‑‑
參考解法
方法 1:
If you want to duplicate the mesh without any changes, you should use the second approach and call then mMesh‑>AddRef()
to declare the data is owned by two pointers (better idea is to use some kind of smart pointers ‑ COM or boost::shared_ptr
adapted to COM‑like objects).
But the first case should work too ‑ what is the data
object about?
(by Dani、crazylammer)