Stencil shadow drawing?

BlitzMax Forums/BlitzMax OpenGL Programming/Stencil shadow drawing?

Here is the current state. The boxes appear correctly, but the oildrums clearly have some bad mistakes. Can anyone tell what is going on here?