Hello, in my experiment I would like to have a background with random noise (changing with every frame) and, in each trial, a short presentation of a Gabor grating, such that its luminance values are summed to the noise.
My understanding is that to create a Gabor with CreateProceduralGabor and Screen(‘DrawTexture’), I need the default Screen(‘BlendFunction’,w, GL_ONE, GL_ZERO), but this prevents the grating and noise from being combined (the grating just covers the background noise). Instead, with Screen(‘BlendFunction’,w, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), they are summed, but the grating is not displayed correctly. How should I do?
Use Screen(‘BlendFunction’,w, GL_ONE, GL_ONE)
for simple addition of background/whatever’s there already with whatever is drawn now, e.g., the gabor. Sometimes you may also need a floating point framebuffer for higher precision or proper handling of signs, e.g., the negative half-wave of a gabor.
Cfe. AdditiveBlendingForLinearSuperpositionTutorial.m