Complex shadows

Hi, I know how to produce basic shadows on the ground (plan) but I don’t know how to make one on a sphere, on a cylinder etc…
Could somebody explain it?

look for shadow volume algorithm.
if you have a hw stencil buffer, (nvidia cards supports it) the algo is reasonably fast, and also it is geometry-independent, so it will cast shadows over every object.

go to, developers section, and download kilkgard’s demo and source.