I'm struggling on a simple project, as an example/sandbox, I'm rendering a small oscillating rectangle on my output. I'm not using glclearcolor() but instead, on every frame I draw a black rectangle before anything else, blending with:

My goal is to see as I play with the alpha of this black rectangle feedback of previous frames, slowly fading, some kind of trail, and it's more or less working.

My main problem though, the trail never really disappears, and the longer I try to get the trail, the worse it gets. Also, I have to quite crank the alpha before seeing any trail, I don't really understand why.

enter image description here

  • 1
    \$\begingroup\$ Think about quantization. On a notepad, start with 1. Multiply by your alpha value. Round to a multiple of 1/255. Repeat. How many iterations before you reach zero? Or do you get stuck at some point, where multiplying by alpha doesn't lower the value below the threshold for rounding back up? \$\endgroup\$
    – DMGregory
    Mar 28, 2021 at 14:26


You must log in to answer this question.

Browse other questions tagged .