Passing Colours Through Shaders

Hello guys,

I’ve just started learning OpenGL and need some help with passing through colours. When I had just a vertex and fragment shader, I could pass colours through simply. Then I added tessellation control and tessellation evaluation shaders, and am not sure how to pass them through. My ultimate goal is to apply lighting to a sphere, but right now I just need to get the colours working.

In my vertex shader, I have this declared:
layout (location=2) in vec3 colour;
out vec3 v_colour;

In my fragment shader:
in vec3 v_colour;
out vec4 colour;

How can I pass it from the vertex shader through tessellation control and evaluation to the fragment shader?

Thanks for any help.

Mr_Bean

Not a lot changes except the input is an array of all the patch vertices and you have to decide which input colour to use as an output for an output vertex - it may even be a computed colour

Thanks for the reply. I’ve managed to get the colours working.
I have another problem now. I’ve added a geometry shader (to implement Flat Shading), but it complains that it can’t find my uniform mat4s when using glGetUniformLocation (which are declared in the Tessellation Evaluation shader). How can I fix this?

EDIT: Never mind, I had an empty main function in the GS. When I put pass-through code in, the problem was resolved.