First Plugin

< All Topics

First Plugin


With the plugin template set up, we can create our very first plugin. Follow the steps in the last topic to create a plugin called GradientBasic. For simplicity, this plugin will be a source that creates a red – blue gradient.



The only changes to make to the template for this plugin are to edit the plugin information and add the vertex and fragment shader code.

Plugin Information


static CFGLPluginInfo PluginInfo(
PluginFactory< GradientBasic >,
“FFGL Basic Gradient”,
“Makes a basic gradient”,
“FFGL Basic Gradient”


Vertex Shader


static const char vertexShader[] = R”(
#version 410 core
layout( location = 0 ) in vec4 vPosition;
layout( location = 1 ) in vec2 vUV;
out vec2 uv;
void main()
gl_Position = vPosition;
uv = vUV;

Fragment Shader


static const char fragmentShader[] = R”(
#version 410 core
in vec2 uv;
void main()
//Position (x coordinate) varying pixel color
vec3 col = vec3(1.-uv.x,0.,uv.x);
//Output to screen
fragColor = vec4(col,1.0);



To build the plugin, right click on the GradientBasic subproject and click Build. Once the project is finished building, GradientBasic.dll will be created in

ffgl-master/binaries/x64/Release. This shared library file is all a host would need to load this plugin.


Previous: Plugin Template

Next: Basic Plugin