Bad Performance - oF 0.10 armv6 rpi3b+ ofshader

#1

Hi,
i’m working on a project with about 70 small fbo’s (200 x 200 pixel) that i bind to very simple 3Dgeometry (planes) as textures. I’m on a rpi 3b+, 512mb allocated to gpu, raspbian stretch, of 0.10.0. and a very good power supply. I’m getting a framerate of constant 40fps. i’m happy with that. but when i tried to add shaders with ofshader the fps went down to 6fps. if i want to use shaders i initialise the window with gles, like that:

ofGLESWindowSettings settings;
settings.setSize(768, 576);
settings.setGLESVersion(2);
ofCreateWindow(settings);

ofRunApp( new ofApp());

the shader is a very simple one. If i dont draw all the geometry textured with the fbo’s, oddly nothing changes considering the performance, still 6fps?
Is this drop in performance normal on a pi3b+ or are there any things i can do to optimize things?

Thank you very much!
Oli

#2

do you are also using ofxGui ? i have big drops in framerate when i’m using ofxGui and i set the GLES version to 2, the framerate is fine when the gui is not displayed, you can try with a bShowGui boolean flag

#3

i’ve found some calls are really slow - especially mix()

#4

thanks npisanti and jvcleave!
both ofxGui (i’m not using the addon) and the mix()-call are not causing the bad performance in my case. At last,i could identify two ofPolyline.draw() calls (each ofpolyline with about 12 vertices) causing the performance drop. i tried some workarounds:

  • several ofDrawLine calls : failed

  • ofMesh rendered with OF_PRIMITIVE_LINE_STRIP: failed

  • ofMesh rendered with OF_PRIMITIVE_TRIANGLES simulating lines with filled triangles: success and i have my 50fps again.

Also ofDrawBitmapStringHighlighted is causing severe performance drops.

Strange isn’t it? i’m on ofv0.10 RPI 3b+ Stretch 512MB GLES (for using shaders). When i compile with OPENGL window, everything works like a charme with fine performance. Unfortunately, shaderes arent working with OPENGL.

I have some other questions concerning fbos with GLES:

  • should it be possible to draw a fbo into another one? its not working properly in my case

  • i’d like to draw 3d-stuff into a fbo. so i need depth information. i’m enabling depthtesting before drawing onto fbo with OfEnableDepthTesting();. but depth-information is not recorded somehow. i tried to enable depth buffer with “ofFboSettings s;” when allocating the fbo, no success either. Also there is an error logged “fbo Attachment Failure” when i allocate with “s.depthBuffer = true;”

I would be happy about tips and nudges in any direction. Thx

#5

ofDrawBitmapStringHighlighted is really bad for performance, we should look into deprecating it or implementing it in a different way cause it does a ton of state changes only to draw a bit of text with a rectangle. It might be fine if you are not doing much more in a relatively powerful graphics card but it will definetly kill performance in something like raspberry

Also the fixed pipeline emulation is kind of slow in small machines cause of how we upload uniforms like transformation matrices…