Capping a Sphere from two sides with stencil buffer.

As of yet I’ve still been unsuccesful in my attempts to cap a sphere, I’ve gotten the stencil buffer to recognize and draw, but it will only draw the caps under very specific circumstances. I’m slicing a sphere with a glclipplane and am trying to use the stencil buffer(turning where I draw sphere to 1 and only drawing on ones) to draw a ‘cap’ over the two ends of the sphere that have been sliced by the clipping plane, and when I rotate around it, only at a very certain angle and only on one side does a cap show up. I can’t figure out if the caps themselves are getting sliced or whether it’s merely faulty methodology.