Now that we’ve created our first plugin, we can start experimenting with what really makes FFGL plugins come alive. Our first plugin only creates the exact same frame every time. We can add some controls or Parameters, as they are called in the world of FFGL, to make the plugin interactive.
Next, we will introduce built-in FFGL variables like time as another way to make the plugin render a more interesting frame each time.
Variables like time are built-in FFGL uniforms that the SDK’s Plugin class will update in the shader when the UpdateAudioAndTime method is called in ProcessOpenGL. This variable and other built-in variable of the FFGL SDK allow for plugins to make changes to the frame being rendered without any input from the user.
In this plugin, time is used to vary the midpoint of the gradient.
Below is a list of all built-in FFGL variables:
In addition to the built-in FFGL variables, plugins use Parameters to allow the user to specify how a frame is created. Refer to the FFGL Parameter Guide for a more detailed list of the parameters available in the FFGL SDK.
The most basic parameter type is the standard parameter (FF_TYPE_STANDARD) which is a floating point number between 0.0 and 1.0. Color parameters are formed by putting 3 (RGB / HSL) or 4 (RGBA / HSLA) standard parameters together.
The only big changes we need to make to adapt our basic gradient plugin is to add two color parameters Color1 and Color2 in our constructor and then change our fragment shader to render a frame using the values of these parameters.