Cutting 3D model on layers

Im writing software for 3D printer, for something like this. []( My software open STL files and show 3D model, and this is all i have for now. Problem is that software must cut this model on rasters , layers, and calculate vector for all conturs and this is what i cant do , im wondering witch procedures should i use for this , meybe some of you can sugest some methods for this, im begginer in opengl so it is little hard for me to find good method for me.

No one know ?