How can I create a geometry shader that can handle multiple primitives? For example when creating a geometry shader for triangles, I define a layout like so:
layout(triangles) in; layout(triangle_strip, max_vertices=3) out;
But if I use this shader then lines or points won't show up. So adding:
layout(triangles) in; layout(triangle_strip, max_vertices=3) out; layout(lines) in; layout(line_strip, max_vertices=2) out;
The shader will compile and run, but will only render lines (or whatever the last primitive defined is).
So how do I define a single geometry shader that will handle multiple types of primitives? Or is that not possible and I need to create multiple shader programs and change shader programs before drawing each type?