iStripper uses these for the
Time and Resolution u_Elapsed is a
float, it is floating point variable ( must use a decimal point with a float, such as 1. or 0. or 3.0 )
it starts counting the time in milliseconds when the shader starts, and continues to count till the shader ends.
u_WindowSize is a
vec2 ( it has a width and a height value, or 2 components )
you can use a swizzle to get one or both of them.
u_WindowSize.x gets just the width, this is an
int or a single component.
u_WindowSize.y gets just the height, this is an
int or a single component.
u_WindowSize.xy gets both, this is a
vec2, it has two components
you can also use
u_WindowSize.u in place of
u_WindowSize.xu_WindowSize.v in place of
u_WindowSize.yu_WindowSize.uv in place of
u_WindowSize.xyuse care when using swizzles to make sure both sides of an = sign, have the same number of components
this is one of the areas that can cause errors that are next to impossible to hunt down.
this is how we write them in the shader
uniform float u_Elapsed; // The elapsed time in seconds
uniform vec2 u_WindowSize; // Window dimensions in pixels
now that we have the iStripper time and resolution as inputs
we define New variables and assign the iStripper inputs to use
It's easier to use the shader toy names, and NOT edit every place in the shader.
so for the Chess shader, Just define two variables using the shader toy name.
#define iTime u_Elapsed //( varable iTime will get its value from the iStipper variable u_Elapsed )
#define iResolution u_WindowSize //( variable iResolution will get its value from iStripper variable u_WindowSize )
in the shader we can now use
iTime in place of
u_Elapsed and
iResolution in place of
u_WindowSizesince the shader already is written, using
iTime and iResolution variables, you don't have to edit every place where they are used.