I searched for 'copy' in the SL reference and couldn't find anything related.
If I have:
float a[3] = float[3] (1.0,2.0,3.0);
float b[3] = a;
Is b
now pointing to a
? If I change b[0]
would that alter a[0]
?
If the answer is yes, is there a copy function that I could use to a get a clone of a
and not point to it? thanks
See GLSL - The OpenGL Shading Language 4.6; 5.8. Assignments; page 114
Assignments of values to variable names are done with the assignment operator (
=
):lvalue-expression = rvalue-expression
The lvalue-expression evaluates to an l-value. The assignment operator stores the value of r-value-expression into the l-value and returns an r-value with the type and precision of lvalue-expression.
In glsl there is nothing like a pointer or reference or even a "move" assignment. Values are always copied.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With