There is a demo of a cube being subtracted from a tessellated star in real time in the examples, though I cannot for the life of me remember which one. This should be the example to go for.
@MR.Madguy and @dicepd, thank you both for the helpful replies. following the suggestions, I was able to locate the referred example under Samples/Lazarus/meshes/CSG. the function is
CSG_Operation(Mesh1, Mesh2 ,CSG_Union,MeshOutput,'1','2');
to perform a boolean operation on two mesh objects (of triangular patches).
this is pretty close, however, right now, I am using only basic geometries (TGLSphere, TGLGrid, ...), I am not sure yet how to convert the basic geometry objects to TMeshObject. Even those when I set the rendering style to pmLine, I can see a basic geometry have a triangular surface, however, I don't think they are derived from one or another, so I can not cast them to meshes.
I will keep on looking in this direction. If anyone know how to perform CSG on basic geometry in glScene, I will be happy to learn. thanks