Hi,
I want to send a color value through a pipeline consisting of a Vertex Shader, Tesselation Control Shader, Tesselation Evaluation Shader, Geometry Shader and Fragment Shader. I send the color value to the Vertex shader using the function
glVertexAttrib4fv(index, const GLfloat *v)
and my Vertex Shader picks it up using:
layout (location = 0) in vec4 color
I then use an interface block in the Vertex Shader:
out VS_OUT
{
vec4 color;
} vs_out;
vs_out = color;
The Tesselation Control shader then has the following:
in VS_OUT
{
vec4 color;
} tcs_in[];
out TCS_OUT
{
vec4 color;
} tcs_out[];
tcs_out[gl_InvocationID].gl_Position = tcs_in[gl_InvocationID].gl_Position;
However I’m unsure how to handle the input/output of these interface blocks in the shaders that comes after that (Tesselation Evaluation, Geometry & Fragment Shader) since sometimes the blocks should be an array([]) and sometimes not and I’ve tried different ways but without success.
Again, I just want to send that color value all the way to the Fragment Shader so that I can use it there to color the pixels. I also know that you can send it using a single “out” variable but I want to know how to do it using interface blocks.
Thanks,
Robin