OpenGL has direct support for rendering both aliased and antialiased points, but these simple facilities are usually insufficient for simulating small light sources, such as stars, beacons, runway lights, etc. In particular, the size of OpenGL points is not affected by perspective projections. To render more realistic looking small light sources it is necessary to change some combination of the size and brightness of the source as a function of distance from the eye.
The brightness attenuation a as a function of distance, d, can be
approximated by using the same equation used in the OpenGL lighting
equation
Attenuation can be achieved by modulating the point size
by the square root of the attenuation
As the point size approaches the size of a single pixel the resolution of
the raster display system will cause artifacts. To avoid this problem the
point can be made semi-transparent once it crosses a particular size
threshold. The alpha value is proportional to the ratio of the point area
determined from the size attenuation computation to the area of the point
being rendered
More complex behavior such as defocusing, perspective distortion and directionality of light sources can be achieved by using an image of the light lobe as a texture map combined with billboarding to keep the light lobe oriented towards the viewer.