do the blending manually: allocate a new image, and for each pixel in it, take the equivalent pixels in your two source images and calculate the average values of each component (ie dest = (source_1 + source_2)/2). this also gives you a lot more control over the blending.
hey damian, thanks for the reply. but i guess this method is a problem when one sorce is completely transparent and the other one isn’t, for the final image will be the not-transparent one, but half way transparent (or half way darker), right?
but i liked the idea of doing it so. then, which would be a good method to do the same as the alpha blending, but manually?
Create a copy of ofImage.h and ofImage.cpp and call it ofImageFBO.h and ofImageFBO.cpp and change all references of ofImage to ofImageFBO.
create an ofImageFBO, render everything to the FBO in ofImageFBO. then use ofImageFBO.save() to save.
Note. If ofImage had an ofTexture* instead of an ofTexture, then we wouldn’t need to duplicate all the ofImage code, and just create a normal ofImage and make the ofTexture* point to the instance of ofFBOTexture. Bit more complex backend, but shouldn’t affect basic users… only give more options to advanced users… dunno what other of’ers thing…
Just realized ofImage.saveImage() doesn’t actually read back from video memory…
So you’d need to use glGetTexImage() to read the texture (in the FBO) back to main memory, then use ofImage (or FreeImage directly).
thanks to all for the solutions. i actually did it with theo’s and it worked pretty well. quite simple. i liked it.
but, just a thought, it would be interesting to make it possible to draw to an image object, but not on the screen. it has many possible uses, avoiding the grabScreen to create new images with the app on the run.