I am working on a project where (and I am simplifying a little)
I need to calculate cross sections of 3-dimensional shapes and render them. For example, I may have a list of tetrahedrons (each tetrahedron consists of 4 vertices), or a list of triangular prisms (each triangular prism consists of 6 vertices), or a list of n prisms (each n prism consists of 2 * n vertices), etc. I want to calculate two-dimensional cross sections of them (the two dimensional cross sections would be made up of triangles), and render the cross sections.
The simplest and most efficient way I have thought of for this is sending the 3D vertices to the vertex shader, then sending them to the geometry shader and taking the cross sections there. However, in order to do this, the geometry shader would need to take in primitives with 4 points, or 6 points (more than 3 points). This is a problem, because to my knowledge the geometry shader can only take in points, lines, and triangles, and nothing with more points. I could solve this by storing the attributes of several 3D vertices in a single GLSL vertex, but this would be very complicated and inelegant.
Question:
Is there a way for the geometry shader to handle primitives of custom lengths, similar to the patch primitives used in tessellation shaders? I will still only be outputting triangles from the geometry shader.
Note: By the way, I am kind of new to OpenGL, so tell me if I got any of the terminology wrong.
Edit: By "cross section" I mean any cross section along a plane that is not necessarily aligned with the bases of the prisms. There will therefor be a variable number of triangles resulting per cross section. For example, a plane may intersect a tetrahedron at 0, 3, or 4 points, and the geometry shader (ideally) would take in 4-point primitives and output either 0, 1, or 2 triangles. Also, my question has nothing to do with the actual cross section calculation. I am asking specifically whether there is a way to use a primitive with more than 3 points as an input to the geometry shader. Finally, this is the second question I have posted, so I don't know whether I have formatted things properly. Sorry if I haven't!