I’m writing a Geometry-Shader where subroutines are used but it seems that a call to EmitVertex in a subroutine seems not to work - I get no visual output. On the opposite when I make the call to EmitVertex from main everything works fine.
This piece of code works:
subroutine void layerRendering( int vertexIndex );
subroutine ( layerRendering ) void layerRenderingCube( int vertexIndex )
{
gl_Position = Transforms.projectionMatrix * gl_in[ vertexIndex ].gl_Position;
}
subroutine ( layerRendering ) void layerRenderingPlanar( int vertexIndex )
{
gl_Position = Transforms.projectionMatrix * gl_in[ vertexIndex ].gl_Position;
}
subroutine uniform layerRendering layerRenderingSelection;
void main()
{
for( int i = 0; i < gl_in.length(); i++ )
{
layerRenderingSelection( i );
EmitVertex();
}
}
This piece of code produces no output:
subroutine void layerRendering( int vertexIndex );
subroutine ( layerRendering ) void layerRenderingCube( int vertexIndex )
{
gl_Position = Transforms.projectionMatrix * gl_in[ vertexIndex ].gl_Position;
EmitVertex();
}
subroutine ( layerRendering ) void layerRenderingPlanar( int vertexIndex )
{
gl_Position = Transforms.projectionMatrix * gl_in[ vertexIndex ].gl_Position;
EmitVertex();
}
subroutine uniform layerRendering layerRenderingSelection;
void main()
{
for( int i = 0; i < gl_in.length(); i++ )
{
layerRenderingSelection( i );
}
}
I’ve checked with NVidia Nsight, the subroutines gets called in both scenarios, so this shouldn’t be the problem. I couldn’t find any limits on where to call EmitVertex. Have I ignored something? Is there a hint in the API?