Geometry shader to handle quads

Hi,

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

please advise

TIA
Satya

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.

In the Nvidia GL spec, apparently :wink: Sorry for the mis-info.

Thanks, Alfonse Reinheart,

http://www.opengl.org/registry/specs/EXT/geometry_shader4.txt
this is where i read the specification of the geometry shader extension.

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

Please suggest

Thanks again
Satya

this is where i read the specification of the geometry shader extension.

The EXT specification is not the same as the core functionality. Even the ARB version of geometry shaders is different.

Which one do you actually intend to use?

i was intending to use the GL_ARB_geometry_shader4, please suggest

Thanks

satya

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.