Hello,
after a rather long absence, I’m coming back to OpenGL coding and much has happened.
I’m trying to get started rendering a shaded triangle with the VAO/VBO and shaders, however I’m facing some difficulties that you might be able to help me with.
I’m playing with the following VS/FS combination:
// VERTEX SHADER
#version 330
layout(location = 0) in vec3 vertex;
layout(location = 1) in vec4 vertex_color;
smooth out vec4 ColorVar;
uniform mat4 modelview;
uniform mat4 projection;
void main() {
gl_Position = modelview * vec4(vertex, 1.0);
ColorVar = vec4(1.0,1.0,1.0,1.0);
// ColorVar = vertex_color;
}
// FRAGMENT SHADER
#version 330
smooth in vec4 ColorVar;
out vec4 out_color;
void main() {
out_color = ColorVar;
// out_color = vec4(1.0f,1.0f,1.0f,1.0f);
}
The fragment shader always procudes black output whenever I have that ColorVar data channel between VS and FS declared (smooth or not). It doesn’t matter if the FS actually uses its value or not, whenever ColorVar is not removed from the shaders, all I get is the darkest black (even if I set the FS’s output to the hardcoded value).
Can you spot the mistake I’m making? The Shader and Program logs are empty, glGetError is not reporting anything, transformation is working, but I can’t get colors from VS to FS
Kind regards,
decimad