AnsweredAssumed Answered

Why does IFace2::GetTessTriStrips sometimes return System.DBNull

Question asked by Brad Phelan on Mar 17, 2016
Latest reply on Mar 18, 2016 by Artem Taturevych

I'm trying to render some IBody2 objects using opengl in the BufferSwap callback. I do this by iterating the faces and calling




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<IBody2, Tuple<IBody2, Color>> BodiesToRender = new ConcurrentDictionary<IBody2, Tuple<IBody2,Color>>();


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<IBody2, Color> dummy;

                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<IFace2>(), _ISwApp, o.Item2, 2.0f);




The MeshRender.Render method is the one that calls GetTessTriStrips.