Shader "ignores" ofDrawRectangle()

#1

I’m trying to pass a FBO through a perlin noise shader. The FBO contains ofImages and rectangles drawn via ofDrawRectangle() and debug messages drawn via ofDrawBitmapString().
The shader works unexpected in the sense that it 1) ignores the Rectangles and the BitmapStrings and 2) does the perlin noise transformation per ofImage within the FBO instead of the whole FBO, if that makes sense.

vertex:

#version 120
#extension GL_ARB_texture_rectangle : enable
#extension GL_EXT_gpu_shader4 : enable

void main() {
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_FrontColor = gl_Color;
}

fragment:

#version 120
#extension GL_ARB_texture_rectangle : enable
#extension GL_EXT_gpu_shader4 : enable
**uniform** **sampler2DRect** texture0;
**uniform** **float** time;
**uniform** **float** multiplicator;

*//Classic Perlin noise function declaration*
**float** cnoise( **vec3** P );
**void** main(){
**vec2** pos = gl_TexCoord[0].xy;

*//Shift pos using Perlin noise*
**vec2** shift;
shift.x = cnoise( **vec3** ( pos*0.01, time * 0.5 + 17.0 ) )*multiplicator;
shift.y = cnoise( **vec3** ( pos*0.01, time * 0.5 + 12.0 ) )*multiplicator;
pos += shift;
**vec4** color = texture2DRect( texture0, pos );

*//Output of the shader*
gl_FragColor = color;

}

I left out the rest of the fragment shader because I don’t think it’s relevant to the program and in my OF code I’m using an ofShader something like this:

    waveShader.begin();
    float time = ofGetElapsedTimef();
    waveShader.setUniform1f( "time", time );
    waveShader.setUniform1f( "multiplicator", ofGetFrameNum() % 300);
    
    myFbo.draw();

    ofDrawBitmapString( "FPS: " + ofToString(ofGetFrameRate()  ), 80,80 );
    
    waveShader.end();

The FPS string for instance will disappear, instead of getting perlin warped too (which is what I expected).

#2

I think should be:

myFbo.begin();
waveShader.begin();
.. // your code here
..
..
waveShader.end();
ofDrawBitmapString( "FPS: " + ofToString(ofGetFrameRate()  ), 80,80 );
myFbo.end();

myFbo.draw(0,0);

You can draw your FPS: after myFbo.draw(0.0); too.