The rendering is different if I render my scene directly on the screen, and if I render on a FBO (frame buffer object), I suspect that the add blend mode is not working in the later case:
Here is the result directly on screen:
Here is the result with a frame buffer:
As you can see, in the frame buffer the blue color does not sum to become bright (and eventually white).
To draw on screen I just call the draw particles function:
@arthur_sw, are you setting the blend mode to OF_BLENDMODE_ADD or OF_BLENDMODE_ALPHA? And then are you disabling that blend mode before drawing your fbo?
I see on stackoverflow that you are using a 32 bit precision fbo, which I assume you are using because it has a high color precision than drawing to the screen directly. One guess might be that the difference between what you are showing might be due to color rounding during blending. Have you tried using GL_RGBA16F_ARB instead of GL_RGBA32F_ARB and comparing the results?
Yes, this does replicate very well my problem ! Thanks : - )
I’ll also transfer this on stackoverflow, hopefully someone will understand what’s going on.
Hey guys,
I had similar issues lately. And I ended up seeing that my problem was because of blending twice (in fbo and when applying fbo). read this posts carefully and check that out:
Oh I’m sorry if those posts didn’t help… I’m checking it myself now… it seems that you have a different problem here. I guess that ofClear might fix it… I’ll give it a try.
So to clarify for @arthur_sw (and myself) as to what’s going on here, I’m attaching some more code that uses @Jordi’s as a jumping point.
Pushing and popping the style was important because the ofSetColor(...) commands were applying a tint to the fbo. If we remove the push/pop and then add in ofSetColor(255,255,255) before drawing the fbo, everything is peachy. (Well, you need to add back the ofDisableAlphaBlending() because the push/pop was also saving and restoring the blend modes).
The switch to using GL_RGB was a red herring. You can still use GL_RGBA32F and have it work. (Though it is really surprising to me that using GL_RGB would work with drawing colors with transparency…?)
Correct - you just needed the ofSetColor(255, 255, 255) call before the fbo draw.
When everything is being passed to the GPU for rendering, I think that the vertex colors are being set by ofSetColor(...). With the openGL settings used by openFrameworks, the texture (from your fbo) gets blended with the vertex colors, which resulted in you having blue-tinted fbo renderings.
Leaving up to @Jordi to answer on stackoverflow if he wants to do so.