GL3 shader question/ shader question

Dante's icon

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

Federico-AmazingMaxStuff's icon

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:
https://www.tutorialspoint.com/cprogramming/c_functions.htm

Dante's icon

Thank you Federico, that was very helpful.