Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: how to merge to images to one image?

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2012
    Posts
    5

    how to Alpha blend two images to one image?

    Hey

    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.

    Thanks
    Miki
    Last edited by michpre; 07-29-2012 at 11:54 PM.

  2. #2
    Intern Contributor
    Join Date
    Apr 2012
    Posts
    90
    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?

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    941
    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.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •