Re: How can I store global variables one by one in an array?
Larry Gritz
I'm not sure what you mean by the "coordinate of P" or what you mean by "an array from a global variable." Can you explain in more detail, or maybe show a few lines of code illustrating what you want to do?
The "global variable" P is just the position of the single point that is being shaded by that invocation of the shader. Do you mean getting at the individual x, y, and z values for that point using an array notation? You can just say P[0] for the x coordinate (this is equivalent to saying P.x), P[1] for the y coordinate (same as P.y), and P[2] for the z coordinate (same as P.z).
|
|