I am working on an old code base that uses Geometry shaders. It uses "glProgramParameteriEXT(...) to enable and specify Input/Output of the GS. The code in question is rendering curves.
The input to the GS(via above mentioned method and not in the GLSL using layout specifier) is GL_LINES_ADJACENCY and output is GL_TRIANGLE_STRIP. And in the actual GLSL Geometry shader, the code spitting out two EmitVertex() as expected by GL_LINES. Eventually at the time of executing the drawcall, glDrawElements (GL_LINES, ....) is used. Is the draw call not supposed to match what was output by the GS, which is GL_TRIANGLE_STRIP? I am not too familiar geometry shaders so I must be missing something. If that is the case, how does openGL figure out to draw triangles while it is told to draw lines?
Thanks!
The
primitivegeometry shader generates primitives from input primitives. The draw call determines the input primitive type; the GS determines the output primitive type. OpenGL "figures out" that it is drawing triangles because that's what the GS says to draw. The GS is part of OpenGL; it's not some foreign entity that gets in OpenGL's way.