title: GLSL operands to arithmetic operators must be numeric
body: <p>I have some old GLSL code that compiled fine previously, but after switching to Linux's gcc compiler it's suddenly throwing errors. From the fragement shader:</p>
  <pre><code>#version 330 core
  out vec4 FragColor;
  
  in vec2 TexCoord;
  in vec3 Normal;
  in vec3 FragPos;
  
  // texture samplers
  uniform sampler2D texture0;
  uniform vec3 lightPos;
  uniform vec3 viewPos;
  uniform vec3 lightColor;
  
  void main()
  {
  //ambient lighting
  vec3 ambLig = vec3(1.0,1.0,1.0);
  float ambientStrength = 0.15;
  vec4 ambient = ambientStrength * vec4(ambLig,1.0);
  
  //diffuse lighting
  vec3 norm = normalize(Normal);
  vec3 lightDir = normalize(lightPos - FragPos);  
  
  float diff = max(dot(norm, lightDir), 0.0);
  vec3 diffuse = diff * lightColor;
  
  //specular lighting
  float specularStrength = 0.5;
  
  vec3 viewDir = normalize(viewPos - FragPos);
  vec3 reflectDir = reflect(-lightDir, norm);  
  
  float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32.0);
  vec3 specular = specularStrength * spec * lightColor;  
  
  FragColor = texture(texture0, TexCoord) * (ambient + diffuse + specular);
  }
  </code></pre>
  <p>This throws an error on the final line, where I calculate <code>FragColor</code>:</p>
  <pre><code>Using ALSA driver
  ERROR::SHADER_COMPILATION_ERROR of type: FRAGMENT
  0:37(45): error: vector size mismatch for arithmetic operator
  0:37(45): error: operands to arithmetic operators must be numeric
  0:37(14): error: operands to arithmetic operators must be numeric
  </code></pre>
  <p>I checked out some <a href="https://stackoverflow.com/questions/5159817/how-to-make-this-code-work-on-mesa3d">previous questions</a> and it seems the problem occurs when using GLSL 1.2 or earlier, since it doesn't do automatic casts. But I have no idea what the problem could be here, since I'm using OPENGL Core 3.3, <a href="https://stackoverflow.com/questions/19021567/finding-supported-glsl-version">which should map to GLSL 3.30</a> Help me please.</p>
  <p>Note: I've included a version of <code>glad</code> in the build with api specified as <code>3.3</code> for convenience. That could be the root of the problem, but I'm not sure, since I believe I build everything correctly.</p>
  <p>EDIT: See answer below, also change</p>
  <pre><code>vec4 ambient = ambientStrength * vec4(ambLig,1.0);
  </code></pre>
  <p>to</p>
  <pre><code>vec3 ambient = ambientStrength * ambLig;
  </code></pre>