This may be odd because as I understand a vector and a scalar cannot be added. However I've found this sample and in line 157 it doing the following operation:
hsv.x + vec3(0.,2./3.,1./3.)
where hsv.x
happens to be a float
number, the value comes from the mouse X coordinates and well the rest is a vec3
.
My question is what is the result of that operation?
If you add a scalar to a vector, then the scalar will be add to each component of the vector, because the The OpenGL Shading Language specification (Version 4.6, Chapter 5 Operators and Expressions) says:
One operand is a scalar, and the other is a vector or matrix. In this case, the scalar operation is applied independently to each component of the vector or matrix, resulting in the same size vector or matrix.