vanattab / slimdx

Automatically exported from code.google.com/p/slimdx
MIT License
0 stars 0 forks source link

PatchMesh::Tessellate() expects an instance of a mesh for argument 2 #860

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi there,

I am trying to use this (your source DirectX9) in csharp:

Result PatchMesh::Tessellate( float tessellationLevel, Mesh^ mesh )
{
   HRESULT hr = InternalPointer->Tessellate( tessellationLevel,  reinterpret_cast<ID3DXMesh*>( mesh->InternalPointer ) );
        return RECORD_D3D9( hr );
}

The problem is: How can I already have a Mesh, when all I have is a PatchMesh. 
This "Mesh^ mesh " should rather be something one can use like "out Mesh mesh" 
in Csharp. 

Trying something like this:

Mesh mesh = null
Result r = pmesh.Tessellate(1f, mesh);
will result in a Nullreference-Error.

Trying something like making a dummy-Mesh:
Mesh mesh = Mesh.CreateSphere(device, 1f, 2, 2);
Result r = pmesh.Tessellate(1f, mesh);
will show an error saying sth about probably protected or defect memory is 
detected.

Thanks for any help

Original issue reported on code.google.com by m...@innoc.de on 17 Feb 2012 at 1:23

GoogleCodeExporter commented 9 years ago
The Tessellate functions, as weird as it may seem, require an already created 
mesh to fill with the tessellated data. I assume you're getting that error 
because the mesh you're passing doesn't have the right size to hold the 
tessellated data.

You can use the GetTessellationSize method to retrieve the details necessary to 
create the plain mesh. See this link (C++ source) on the method to do it: 
http://stackoverflow.com/questions/3295349/looking-for-code-samples-for-direct3d
-tessellation

Original comment by Mike.Popoloski on 13 Mar 2012 at 12:39