This morning I decided to get to work studying shaders in the context of multiple light sources, and I notice that for some reason I cannot create a vec4 using a defined vec3 object as I was previously able to. I omitted all the code from one of my fragment shader files and notice that regardless of the name given to a variable the variable cannot be used to create a vec4 object. Is there something wrong with the code here that I do not see?:
#version 330 core
out vec4 frag_color;
in vec3 frag_pos;
in vec3 normal;
in vec2 tex_coords;
void main()
{
vec3 result(1.0f, 1.0f, 0.5f);
frag_color = vec4(result, 1.0f);
}
If I define frag_color as vec4(1.0f, 1.0f, 0.5f, 1.0f)
the program runs fine with no report of a fragment shader compiling unsuccessfully. I do not recall these semantics being a problem previously, it seems that only this morning after finishing writing the shader the program complains about unsuccessful fragment shader compilation. Everything else is running smoothly and without issue.
In fact, even declaring a vec3 object prevents the shader from compiling, I see.
EDIT: The issue was solved by writing vec3 test = vec3(1.0f, 1.0f, 0.5f)
. Is this normal behavior for OpenGL?