Kinect / Docs

Markdown documentation for Kinect for Windows
MIT License
74 stars 35 forks source link

C++ SDK GetFaceModelTriangles() always fails #19

Open pixelnerve opened 7 years ago

pixelnerve commented 7 years ago

This function doesn't seem to work at all. Is there more information about this function ?

diablodale commented 7 years ago

Have you allocated the needed memory structures? The doc lacks detail on that. Here is code that works for me:

hr = GetFaceModelTriangleCount((UINT32*)&m_HDFaceModelTriangleCount);
if (SUCCEEDED(hr))
{
    m_pHDFaceModelTriangleVertexIndices = (UINT32*)malloc(m_HDFaceModelTriangleCount * 3 * sizeof(UINT32));
    if (m_pHDFaceModelTriangleVertexIndices)
    {
        hr = GetFaceModelTriangles(m_HDFaceModelTriangleCount * 3, m_pHDFaceModelTriangleVertexIndices);
    }
    else
    {
        hr = E_OUTOFMEMORY;
    }
}
pixelnerve commented 7 years ago

Ah perfect. That works. I was mislead by the function name. Was using triangle count as capacity. Should be triangleCount * 3

Thanks!