title: GLSL "No Matching Overloaded Function Found" (hsv2rgb)
body: <p>What obvious thing am I missing?  I'm trying to compile/run this vertex shader:</p>
  
  <pre class="lang-c prettyprint-override"><code>// an attribute will receive data from a buffer
  attribute vec2 a_position;
  
  uniform vec2 u_resolution;
  
  varying vec4 v_color;
  
  // all shaders have a main function
  void main() {
      // convert the position from pixels to 0.0 to 1.0
      vec2 zeroToOne = a_position / u_resolution;
      // convert from 0-&gt;1 to 0-&gt;2
      vec2 zeroToTwo = zeroToOne * 2.0;
      // convert from 0-&gt;2 to -1-&gt;+1 (clip space)
      vec2 clipSpace = zeroToTwo - 1.0;
      gl_Position = vec4(clipSpace, 0, 1);
      vec3 c = hsv2rgb(vec3(0.5, 0.5, 0.5));
      /*temporary*/ v_color = gl_Position * 0.5 + 0.5;
      gl_PointSize = 1.0;
  }
  
  // All components are in the range [0…1], including hue.
  vec3 hsv2rgb(vec3 c)
  {
      vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
      vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
      return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
  }
  </code></pre>
  
  <p>using code I found at <a href="https://stackoverflow.com/questions/15095909/from-rgb-to-hsv-in-opengl-glsl">From RGB to HSV in OpenGL GLSL</a> but get the error:</p>
  
  <blockquote>
  <pre><code>https://webglfundamentals.org/webgl/lessons/webgl-boilerplate.html
  webgl-utils.js:66 *** Error compiling shader '[object WebGLShader]':ERROR: 0:19: 'hsv2rgb' : no matching overloaded function found
  ERROR: 0:19: '=' : dimension mismatch
  ERROR: 0:19: '=' : cannot convert from 'const mediump float' to 'highp 3-component vector of float'
  </code></pre>
  </blockquote>
  
  <p>The error is specific to the <code>hsv2rgb</code> call. I have tried a number of things, including making the parameter a variable (i.e. adding <code>vec3 v = vec3(0.5, 0.5, 0.5)</code> and passing <code>v</code> into <code>hsv2rgb</code>), and making a skeleton <code>hbv2rgb</code> that simply returns its parameter. In the referenced SO post, I saw that another user seemed to have exactly the same problem, but I am properly passing in a <code>vec3</code> rather than 3 floats.</p>
  
  <p>If it makes any difference, here is the fragment shader as well:</p>
  
  <pre class="lang-c prettyprint-override"><code>// fragment shaders don't have a default precision so we need
  // to pick one. mediump is a good default
  precision mediump float;
  
  varying vec4 v_color;
  
  void main() {
      // gl_FragColor is a special variable a fragment shader
      // is responsible for setting
      gl_FragColor = v_color;
  }
  </code></pre>