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 7 of 7

Thread: How to load 30 BMP frames to device ?

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

    How to load 30 BMP frames to device ?

    Hey

    I would like to load about 30 BMP frames (30 layers of one image) to device
    and then merge the layers to one image .
    I would like to do that (only the merging) with openGL (in order to get better perfomance)
    I dont want to display the image only the merging and then back the image to save on disk.
    Any idea how to do that?

    Thanks
    Miki

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,128
    Well, the brute-force way would be to load either load your pixels into 30 texture objects and then render correctly sized quads and do some blending operation either with a shader or with fixed blending ops and then read the resulting data back to the application with glReadPixels(). Note that this definitely not the only way to do it, but it's the most simple way IMHO. The problem I see here is that you don't define what merging means in your context.
    Please be more specific.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2012
    Posts
    5
    Thanks

    to be more specific
    I run over the layer
    for (...each layer...){
    for (...image Width...){
    for (....image Height...)
    {
    ouputImage += F(x,y,Layer) ///where F is some function that "merge the pixel for for all layers to one outputImage"
    }
    }
    }

    since I m Newbie to openGL can you also give the basic gl functions (best prototype) of how to do that?

    Thanks much
    Miki

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,128
    The question remains: what is F? Do you want addition, multiplication, difference? Pick one and I'll try to give you an example.

    The rest is fairly basic and not a problem at all.

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

    F chose the visible pixel from the all layers and put it in ouput image (here rgmb_main_raster is output image)
    rgb_main_raster[i]=rgb_main_raster[i]*(1-alpha)+layer_rgb[i]*alpha+k;

    Miki

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,128
    How do you determine alpha? Is is a fixed value? Is it supposed to be determined and stored per pixel? What is k?

  7. #7
    Junior Member Newbie
    Join Date
    Jul 2012
    Posts
    5
    k is constant 0.5
    alpha is per pixel

Posting Permissions

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