This is the geometry shader i made, which from my understanding should simply pass the 3 vertices on to the frag shader? When i remove the geom shader and pass the values straight to the frag shader it works and displays what i want. I am drawing terrain with triangles, each draw call passes 6 vertices (2 triangles) through, perhaps this has something to do with it however i cannot figure out what
#version 330
layout(triangles) in;
layout(triangle_strip, max_vertices = 3)out;
in float gHeight;
in vec4 gSurfacePosition;
in float gTerrainHeight;
in vec2 gTexCoords[3];
in vec4 gNormal[3];
out float oTerrainHeight;
out float oHeight;
out vec4 oNormal;
out vec4 oSurfacePosition;
out vec2 oTexCoords;
void main()
{
oSurfacePosition=gSurfacePosition;
oHeight=gHeight;
oTerrainHeight=gTerrainHeight;
for(int i = 0; i < 3; i++)
{
gl_Position = gl_in[i].gl_Position;
oNormal = gNormal[i];
oTexCoords = gTexCoords[i];
EmitVertex();
}
}