Delphi Firemonkey draw and fill an arbitrary 3D shape or polygon

  

I’m trying to figure out how to fill a 3D polygon using Delphi XE7 Firemonkey. After using GLScene which had in-built components for this, Firemonkey seems to be a health hazard for me since there are less in-built controls, very few samples and less than helpful documentation.

My polygon is generated using this code:

Context.BeginScene;
try
Context.DrawLine(TPoint3D.Create(1, -1, 0), TPoint3D.Create(1, 1, 0), 0.5, TAlphaColorRec.Black);
Context.DrawLine(TPoint3D.Create(1, 1, 0), TPoint3D.Create(0, 1, 0), 0.5, TAlphaColorRec.Black);
Context.DrawLine(TPoint3D.Create(0, 1, 0), TPoint3D.Create(-1, 0.5, 0), 0.5, TAlphaColorRec.Black);
Context.DrawLine(TPoint3D.Create(-1, 0.5, 0), TPoint3D.Create(-1, 0, 0), 0.5, TAlphaColorRec.Black);
Context.DrawLine(TPoint3D.Create(-1, 0, 0), TPoint3D.Create(-0.5, 0, 0), 0.5, TAlphaColorRec.Black);
Context.DrawLine(TPoint3D.Create(-0.5, 0, 0), TPoint3D.Create(-0.5, -1, 0), 0.5, TAlphaColorRec.Black);
Context.DrawLine(TPoint3D.Create(-0.5, -1, 0), TPoint3D.Create(1, -1, 0), 0.5, TAlphaColorRec.Black);
finally
Context.EndScene;
end;

This code generate a polygon like this: https://cyberflexsoftware.tinytake.com/sf/NDQ5NTIxXzI0MjgzNjg

However I need to fill this shape with a color material and I have no idea how to do this. I think I need to create a TMesh but it is hard to figure out without a PHD in maths and I’m completely lost. Any help would be great.

Comments are closed.