Object leaves a trail on alpha background

323 views Asked by At

What is a standard reason for this behavior? I have 2 the same buffers with 2 textures of mesh with premultiplied alpha and alpha background: in the first I have object on background, but the second leaves object trail behind itself when I move it on this alpha background. I can't realise why! FBO's are similar.

enter image description here

Thanks!

1

There are 1 answers

0
javierMarquez On BEST ANSWER

My mistake was I forgot to bind FBO before clearing:

    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glBindFramebuffer(GL_FRAMEBUFFER, FBO);
    glBindFramebuffer(GL_FRAMEBUFFER, 0); // WRONG!

    glBindFramebuffer(GL_FRAMEBUFFER, FBO);
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
    glBindFramebuffer(GL_FRAMEBUFFER, 0); // RIGHT!