how to merge to images to one image?


I would like to load about 2 BMP frames (2 layers of one image) to device
and then Alpha Blending the layers to one image (ie put image B on top of image A (ex A is a background image and B is animal image))

I have :
img_A_rgb_buffer, img_A_alpha_buffer (set to 255)
img_B_rgb_buffer, img_B_alpha_buffer

I would like to do that (only the Blending) with openGL (in order to get better perfomance)
the output will be a img_out_buffer (the img_out_alpha_buffer is equal to img_B_alpha_buffer)
I dont want to display the image only the Blending and then back the image to save on disk.

Any idea how to do that?
I would appreciate specific just basic code.


I would like to load about 2 BMP frames …
One step at a time. Before worrying about combining images, you must first ‘load’ them. Have you figured out how to load an image yet?

Blending two images together is such a simple and non-computational heavy operation that it’s kind of an overkill to use OpenGL to implement it. Probably uploading the images into textures would already take more time than if you would simply blend the images together on the CPU.