I'm trying to write a simple geometry shader what just passes through vertices before attempting to modify stuff.
My vertex shader is
#version 150 core
in vec3 inPosition;
in vec4 inColor;
out vec4 vertexColor;
void main() {
vertexColor = inColor;
gl_Position = vec4(inPosition, 1.0);
}
My geometry shader is
#version 150 core
layout (triangles) in;
layout (triangle_strip, max_vertices=3) out;
void main() {
gl_Position = gl_in[0].gl_Position;
EmitVertex();
gl_Position = gl_in[1].gl_Position;
EmitVertex();
gl_Position = gl_in[2].gl_Position;
EmitVertex();
EndPrimitive();
}
And my fragment shader is
#version 150 core
in vec4 vertexColor;
out vec4 fragColor;
void main() {
fragColor = vertexColor;
}
Without the geometry shader linked in, everything works fine. However when I link in the geometry shader it stops working. What is it that I am missing? Does my Geometry shader require an input for the vertexColor
from my vertex shader and if so how is that done?