Generating lens flares

i know the best way to show a lens flare would be to generate it in a 2d application and use it as a texture, but i would like to know how exactly can i render such an object using code and not pre-generated textures. a more general related question would be ‘how do u make something glow?(glow as in like red hot or burning magnesium)’ because GL_EMISSION does not even get close to the effect.

GPU Gems has a good discussion of this.

Glowing ala TRON is done by rendering the glowing objects with high dynamic range, then bluring that and overlaying that onto the normal scene, I think.