Well, one way would be to use a list of some type, something which gives you access to objects contained within using a key. I use a TStringList

Then, all you need to do is.

1. Drawing routine wants to draw a glow for sprite named "MAN"

2. Check GlowCache (aformentioned list), If glowsurface exists, return it.

2.1 If glow surface does not exist, render the glow to a new surface for the sprite named "MAN" and add the glow to the cache with the key of "MAN", return it.

3. Render the glow to the destination surface.


From this point on, all calls for a glow for the sprite "MAN" will return a pre-generated glow.