This is a very basic geometry shader example.
It draws two vertical lines using immediate mode, where the geometry shader:
- Emits vertices/primitives without change.
- Emits an extra copy translated 0.2 over the x axis.
This will cause four vertical lines to be visible.
I admit it's not very spectacular, but see it as an 'Hello World' type of minimal example.
some observations regarding to the need for casting:
GL.Ext.ProgramParameter 2nd parameter is an int: I cast All.Lines and All.Linestrip here, these are equivalent to the BeginMode ones. These tokens do not exist on ExtGeometryShader4. Only the adjecency ones that are added with this extension are available on the ExtGeometryShader4 enum. Other valid values here are GL_POINTS, GL_LINES and GL_TRIANGLES and their strip variants.
I have to cast (GetPName)ExtGeometryShader4.MaxGeometryOutputVerticesExt for use with GL.GetInteger. I am unsure what the policy here is with EXT tokens.