ID3DX10Mesh::CloneMesh (ID3DX10Mesh::CloneMesh)


問題描述

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 Danicrazylammer)

參考文件

  1. ID3DX10Mesh::CloneMesh (CC BY‑SA 3.0/4.0)

#directx-10 #C++






相關問題

D3D10 (DirectX10) 全屏性能問題 (D3D10 (DirectX10) fullscreen performance issue)

directx10 中的精靈和紋理過濾 (Sprites in directx10 and texture filtering)

Firemonkey 中的 DirectX10 支持(非 10.1) (DirectX10 support in Firemonkey (not 10.1))

錯誤 LNK2019 Directx10 VC++2010 (Error LNK2019 Directx10 VC++2010)

管理 HLSL 效果 (Managing HLSL effects)

D3DX10CreateTextureFromFile 返回未知錯誤 (D3DX10CreateTextureFromFile returns unknown error)

使用 HLSL 變量分配 struct C++ (Assign struct C++ with HLSL variable)

ID3DX10Mesh::CloneMesh (ID3DX10Mesh::CloneMesh)

在 DirectX 10 中清除單個視口 (Clear single viewport in DirectX 10)

Visual c++ DirectX 編譯錯誤 (Visual c++ DirectX compilation error)

將 ID3D11Texture2D 轉換為內存緩衝區 (Convert ID3D11Texture2D into a memory buffer)

DirectX 10.1 / C++:如何通過 ID3D10Resource* 紋理在精靈上渲染文本? (DirectX 10.1 / C++: How to render text on sprite over ID3D10Resource* textures?)







留言討論