GLUtessVertexProc
を使用しているときに、コールバックでランダムにアクセス違反の例外が発生しましたGLUtessellator
。誰か助けてもらえますか? どうもありがとう!メインコードは次のとおりです。
public partial class Tessellation
{
[UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)]
public delegate void GLUtessVertexProc(IntPtr data);
private List<Vector3> _buf = new List<Vector3>();
private static readonly GLUtessVertexProc tessVertex = data => {
double* dt = (double*)data;
//exception occur...
_buf.Add(new Vector3(dt[0], dt[1], dt[2]));
};
public List<Vector3> Tessellate(List<Vector3> outerBound)
{
_buf.Clear();
GLUtesselator tess = GLU.gluNewTess();
GLU.gluTessCallback(tess, GLU.GLU_TESS_BEGIN, tessBegin);
GLU.gluTessCallback(tess, GLU.GLU_TESS_END, tessEnd);
GLU.gluTessCallback(tess, GLU.GLU_TESS_ERROR, tessError);
GLU.gluTessCallback(tess, GLU.GLU_TESS_VERTEX, tessVertex);
GLU.gluTessCallback(tess, GLU.GLU_TESS_COMBINE, tessCombine);
GLU.gluTessCallback(tess, GLU.GLU_TESS_EDGE_FLAG, tessEdgeFlag);
GLU.gluTessProperty(tess, GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_ODD);
GLU.gluTessBeginPolygon(tess, IntPtr.Zero);
//vertex data
GLU.gluTessEndPolygon(tess);
GLU.gluDeleteTess(tess);
return _buf.ToList();
}
}