I'm trying to render some IBody2 objects using opengl in the BufferSwap callback. I do this by iterating the faces and calling
face.GetTessTriStrips
For some of my bodies this works and I can render the triangle strips successfully with opengl using OpenTK. With other bodies the call just returns System.DBNull. It's like the tessellation of the face has not been performed. I would then expect to find an API call to force tessellation but I can't find it. Is there an API to force tessellation on a face when in the context of the BufferSwap callback.
Maybe the bufferswap callback is the wrong place to get the tessellation data.
My scene is pretty simple. I have a concurrent dictionary to store my bodies to render
public static ConcurrentDictionary
and a static method to display them. This returns a disposable that when disposed removes the body from the scene.
public static IDisposable DisplayUndoable(IBody2 body, Color? color)
{
BodiesToRender[body]=Tuple.Create(body,(color ?? Color.Yellow));
return Disposable.Create(() =>
{
Tuple
BodiesToRender.TryRemove(body, out dummy);
});
}
and in BufferSwap I have
private int OnBufferSwapNotify()
{
foreach (var o in BodiesToRender.Values)
{
var b = o.Item1;
MeshRender.Render(b.GetFaces().CastArray
}
}
The MeshRender.Render method is the one that calls GetTessTriStrips.
SolidworksApi macros