i am a beginner to shaders, and i read from the specification that the geometry shader supports only point, line and triangle as the input primitive type and linestrip, trianglestrip and point as the output type
am i correct in my understanding and should i have to render all my quads as triangle or triangle strips to use the geometry shader
What specification did you read that in? GLSL 1.50 says that geometry shaders can use as inputs: “points”, “lines”, “lines_adjacency”, “triangles”, and “triangles_adjacency”. Quads were removed from core OpenGL, so they are not featured. But “lines_adjacency” is more or less GL_QUADS.
In addition to triangles, you can draw quads, tristrips, trifans and polygons when the geometry shader mode is ‘triangles’. Those types are all tessellated by the driver to triangles before being passed to the geometry shader. Each quad would be split into two triangles and these would be processed separately by the geometry shader. If you want to process all 4 vertices for the quad in one geometry shader invocation, then you need to use Alfonse’s suggestion of drawing the quads as line-adjacency primitives, both of which have 4 vertices.
Those types are all tessellated by the driver to triangles before being passed to the geometry shader.
Where in the spec does it say that? Even in the compatibility specification, it states that GL_QUADS will give GL_INVALID_OPERATION when used with a geometry shader.
my requirement is to render quads with one normal per quad, which stops me from using vertex array, so i was thinking if i can use geometry shader to do the normal computation and still use vertex array to render quads with faceted shading
i tried duplicating the vertices, but that becomes too much and i didn’t really see the benefit.
the basic glBegin() … glEnd() suffers when the number of quads become more