Image is all black when using a gaussian blur

Hello, this is my first post, I’ll try to be as concise as possible.
I am using the gaussian blur from the OF exemples in my own projet. (of_v0.11.2_vs2017_release\examples\shader\09_gaussianBlurFilter\bin\data)

Depending on where and when I load the image, I get a completely black image as a result.

this works:
Setup:

 shaderBlurX.load(PATH_SHADERS + "Blur\\shaderBlurX");
 shaderBlurY.load(PATH_SHADERS + "Blur\\shaderBlurY");

 img.load("img.png");
 test = img;

Draw:
fboBlurOnePass.begin();

	shaderBlurX.begin();
	shaderBlurX.setUniform1f("blurAmnt", 10.0);

	test.draw(0, 0);

	shaderBlurX.end();

	fboBlurOnePass.end();

	//----------------------------------------------------------
	fboBlurTwoPass.begin();

	shaderBlurY.begin();
	shaderBlurY.setUniform1f("blurAmnt", 10.0);

	fboBlurOnePass.draw(0, 0);

	shaderBlurY.end();

	fboBlurTwoPass.end();

	//----------------------------------------------------------
	ofSetColor(ofColor::white);
	fboBlurTwoPass.draw(0, 0);

this does not work:
Setup:

 shaderBlurX.load(PATH_SHADERS + "Blur\\shaderBlurX");
 shaderBlurY.load(PATH_SHADERS + "Blur\\shaderBlurY");

 img.load("img.png");

Draw:

        test = img;
        fboBlurOnePass.begin();

		shaderBlurX.begin();
		shaderBlurX.setUniform1f("blurAmnt", 10.0);

		test.draw(0, 0);

		shaderBlurX.end();

		fboBlurOnePass.end();

		//----------------------------------------------------------
		fboBlurTwoPass.begin();

		shaderBlurY.begin();
		shaderBlurY.setUniform1f("blurAmnt", 10.0);

		fboBlurOnePass.draw(0, 0);

		shaderBlurY.end();

		fboBlurTwoPass.end();

		//----------------------------------------------------------
		ofSetColor(ofColor::white);
		fboBlurTwoPass.draw(0, 0);

Bad result:

However, the later example seems to work perfectly fine in the OF example project.
I feel like I am missing something, could someone please guide me in the right direction?

Hi @JJ_B , just a couple of quick comments. Normally I render with shaders into ofFbo in ofApp::update(), and then draw the final ofFbo in ofApp::draw(). The example does it all in ofApp::draw(). Also, its better to copy img into test just once in ofApp::setup(), instead of doing it each cycle in ofApp::draw(). And you should probably call test.update() after you copy img into it. An ofImage has both an ofPixels and an ofTexture in it, and calling test.update() will update its texture.

in ofApp::setup()

img.load("img.png");
test = img;
test.update();

Also make sure the main.cpp is (somewhat) similar to the example project, and that the correct shaders are loading. OpenGL 3.2 would use the shaders that begin with #version 150; these are in the /bin/data/shadersGL3/ folder of the example project. So I’d normally do this in main.cpp:

    ofGLWindowSettings settings;
    settings.setSize(1024, 768);
    settings.setGLVersion(3,2);
    ofCreateWindow(settings);
    ofRunApp(new ofApp());

The data folder is a relative path in oF unless you specify otherwise, so hopefully the correct shaders are loading with the specified path. Its perfectly fine to just copy the shader files into the /bin/data/ folder of the project.