You guys helped me greatly a few weeks ago with your input, and im really hoping you guys can help me out again. My game has come a long way, and now im trying it put some polish on it, primarily im trying to make a bloom, or glow effect on my ship. i have done some Google searching but can only find ways to do this in things like openLayer, or openGL, i know Allegro uses OpenGL but is there a know way to do this strictly in Allegro, with blitting and blending? if so any advice would be greatly appreciated! thank you guys in advanced!
If I understand your effect correctly, I think it can be done manually with putpixel & getpixel(make sure you've acquired the bitmaps, and following them the way they're allocated in memory), by making some of the color coefficient to be based on surrounding pixels.
Append: If there won't be much of this effect, it won't be much of a penalty on for your frame rates..
If you're not going to be using any type of hardware acceleration, try FBlend. It'll at least give you additive blending (for glow effects).
For bloom and blur you'd be better off using either HLSL (that's using DirectX, so it's probably not what you want) or GLSL, which are basically shader languages (so, hardware only). I guess you can emulate bloom in software using getpixel/putpixel, but you'd need to come up with a clever way of doing things.
Basically, bloom just brightens the pixels that are already bright (above a certain treshold) and just leaves every pixel below the threshold be. So yeah, you can do that, but it might be slow, as you're probably going fullscreen with this, and as such, you'll need to operate on the entire screen area in the buffer, and then blit the buffer to the screen. Not really hard to do, but it might (I really have no idea) be slow.
And I second FBlend. It's a great library, and it comes in handy if you're using the old Allegro branch.
Basically, bloom just brightens the pixels that are already bright (above a certain treshold) and just leaves every pixel below the threshold be.
Rather, bloom is just running a low pass filter (blur) of all the pixels over a certain brightness threshold. And doing low pass filtering in software? Slow. Horrendously slow.
So yes, it's doable, but it's going to be too slow to be usable (you need a pretty large radius to make it look good).
So yes, it's doable, but it's going to be too slow to be usable (you need a pretty large radius to make it look good).
A box filter is dirt cheap, and costs the same no matter what size.
For anyone who is interested making simple convolution filters, there's: