GL3 shader question/ shader question

    Dec 03 2019 | 6:19 pm
    What is this block of text after declaring uniforms and varyings, but before the void(main) of the vertex shader?
    The word 'Remap' is used in the vp, which tells me that it is a "declaration" of sorts, but what follows "original_value, ect, new_max, ect" is what I am having trouble with, those do not seem to be declarations and do not exist anywhere else in the shader. So to be super specific I do not understand what is the source of the original value.
    Basically same problem with 'random (vec2 st)' Although I'm guessing 'random' returns said equation.
    Thanks for any insight

    • Dec 04 2019 | 4:10 pm
      Hi Dante, this is a function declaration with some arguments. so "float Remap" means that the function Remap returns a float number. "float original_value" is a place holder for a float number that will later be used in the main function, as are the other arguments for the function. The arguments get used inside the function to evaluate an expression and the value of the expression is returned. As you can see it will be a float number.
      You maybe want to study how a function works in C or other languages, since this is not something special to GLSL:
    • Dec 04 2019 | 9:25 pm
      Thank you Federico, that was very helpful.