If you crop convex objects and know the coordinates of the cropped points, you can create a polygonal "cap" yourself - just draw the selected points in the correct order using GL_TRIANGLE_FAN, and that is. It will not work with a non-convex object - this will require a triangulation algorithm. You can use glu tesselators to triangulate polygons, but it can be tricky.
If the cropped area can be determined by the formula, you can write a shader that will precisely pinch pixels at a certain distance (i.e. if x^2+x^2+z^2 > r^2 do not draw pixel ).
You can also draw inverse faces with a shader that will draw each inverse pixel as if it were on a clip plane using a simple ray tracing. This is complicated and may be redundant in your case. Dead Rising used a similar technique in their game engine.
You can also use a stencil buffer.
First draw the back surfaces GL_INCR ( glStencilOp(GL_KEEP, GL_INCR, GL_INCR) ), then draw the front surfaces GL_DECR ( glStencilOp(GL_KEEP, GL_DECR, GL_DECR) ). Then draw the texture only where the stencil is non-zero. ( glStencilFunc(GL_GREATER, 0, 0xff); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); ). However, if you have many overlapping figures, you will need to take special care of them.
- edit -
However, I am not sure how to continue this information (or if this is even the best approach).
Draw it like a fan of a triangle. For convex objects, this is all you need. For non convex objects that will not work.
ve read on stencil buffers. One approach may be to turn the intersection line into a 2d shape
No, that will not work. The region you want to fill with the texture must have a specific stencil value. The way stencil cropping works.
to somehow fix the texture
In OpenGL, you have 6 (?) Clip planes. If you need more, you will need advanced methods - stencil, getting intersection lines, shaders or triangulation.
Any online examples you can point me to will also be very helpful.
Drawing filled concave polygons using a stencil buffer