I am following a tutorial and I need to clamp all place values of a triangle between 0 and 1 then output them as a colour
that is the code for my vertex shader:
#model 330
format (location = 0) in vec3 pos;
out vec4 vCol;
uniform mat4 mannequin;
void most important(){
gl_Position = mannequin * vec4(pos, 1.0);
vCol = vec4(clamp(pos, 0.0f, 1.0f) 1.0f);
}
and that is the code for my fragment shader:
#model 330
in vec4 vCol;
out vec4 colour;
void most important(){
colour = vCol;
}
these are coordinates of my form, which is a triangle (the values which might be going to be clamped):
GLfloat vertices[] = {
-1.0f, -1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
0.0f, 1.0f, 0.0f
};