I would like to create a glow effect in GLSL, there is a tutorial that explains how we multiply RGB * a :
I have some questions :
is it an operation that is in a fragment shader, where RGBa is calculated each frame, and then we apply the blur at the end of the shader? The whole process in the same shader, called each frame? Or can we multiply RGBa in a separate process at the beginning of the game and send this texture to the fragment that will blur the result?
I have tried to translate the informations I found, but I am a beginner with the shaders, could someone put me on the right track here? Should we use a "buffer"? Here is my starting code :
GLuint CreateBufferForMixAB() {
unsigned char * data;
GLuint bindingPoint = 1, mixTex, buffer;
glGenTextures( 1, &mixTex );
glBindTexture( GL_TEXTURE_2D, mixTex );
data = (unsigned char *)malloc( width * height );
...imageTex.rgb * alphaTex.rgb...
glGenBuffers(1, &buffer);
glBindBuffer(GL_UNIFORM_BUFFER, buffer);
glBufferData(GL_UNIFORM_BUFFER, sizeof(mixTex), mixTex, GL_DYNAMIC_DRAW);
glBindBufferBase(GL_UNIFORM_BUFFER, bindingPoint, buffer);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB,
GL_UNSIGNED_BYTE, data);
}
Thanks