Blending is not done with FBO texture

Hi, I’m using two FBO, the first draw a red rectangle and the second draw a blue and a green rectangle.
But it draw only the green and blue rectangle, it doesn’t draw the red rectangle and the blending is not done at the intersection of the blue and the green rectangle.
Here is the source code (with SFML) :

int main(int argc, char* argv[])
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "test blending", sf::Style::Default, 
    sf::ContextSettings(0, 0, 0, 3, 0));
    sf::RenderTexture rt1, rt2;
    rt1.create(800, 600, sf::ContextSettings(0, 0, 0, 3, 0));
    rt2.create(800, 600, sf::ContextSettings(0, 0, 0, 3, 0));
    sf::RectangleShape tile1 (sf::Vector2f(100, 50));
    tile1.setFillColor(sf::Color(255, 0, 0, 50));
    sf::RectangleShape tile2 (sf::Vector2f(100, 50));
    tile2.setPosition(50, 25);
    tile2.setFillColor(sf::Color(0, 255, 0, 50));
    sf::RectangleShape tile3 (sf::Vector2f(100, 50));
    tile3.setPosition(-50, 25);
    tile3.setFillColor(sf::Color(0, 0, 255, 50));
    sf::Sprite trt1(rt1.getTexture());
    sf::Sprite trt2(rt2.getTexture());
    while (window.isOpen()) {
        sf::Event event;
        while (window.pollEvent(event)) {
            if (event.type == sf::Event::Closed) {
                window.close();
            }
        }
        window.clear();
        rt1.clear();
        rt2.clear();
        rt1.draw(tile1);
        rt1.display();
        rt2.draw(tile2);
        rt2.draw(tile3);
        rt2.display();
        window.draw(trt1);
        window.draw(trt2);
        window.display();
    }
    return 0;
}

I don’t have this problem on my laptop with mesa driver and an amd grapgic card, nvidia driver bug ?
I’ve created a post on the nvidia forum.

What OS or Linux distro are you using?

This is a SFML question, not an OpenGL one (even if SFML is using OpenGL behind the scenes). It would be better addressed to a SFML-related forum.

I’m using windows 10.
Ok I’ll post it on the SFML forum but someone told me there are other parameters for blending with an FBO but I don’t know which parameters to set.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.