Using ofxFX addon with OpenGL 3.x/4.x

Hi everyone, I’m trying to use the ofxFX addon to build a ping-pong shader based particle system where particle data is stored in the ping pong buffers.

I would like to use a modern version of OpenGL, 3.3 or higher in order to take advantage of the programmable pipeline and better shader syntax.

However, the addons’ built in vertex shader and filter objects are all designed around using legacy OpenGL v2.1.

I setup the shader as follows

particleData.allocate(texSize, texSize, GL_RGBA);

which loads the files “Particle.frag” and “Particle.vert”

When I try to load my own custom shaders (Vertex and frag) it doesn’t draw.
For now, just to get things up and running, my vertex and fragment shaders are as below:

Vertex Shader

#version 330 core

in vec4 position;

uniform mat4 MVP;

void main() {
  gl_Position = MVP * position;

Fragment Shader

#version 330 core
uniform sampler2D tex0;
uniform sampler2D tex1;
uniform sampler2D backbuffer;

out vec4 fragColor;

void main() {

  fragColor = vec4(0, 0, 1.0, 1.0);

The frag shader should just draw a simple blue square on the screen when my object calls draw(), but instead the square flashes black for a frame then disappears.

I call update() on my object in ofApp::update().

Could someone who is familiar with this addon help me figure out what I’m missing?

Thanks so much.

@patricio As the creator of this addon, would you be able to help?