Hi,
I’ve just bought the OpenGL-Superbible, perhaps someone has it, too, so he might understand better my problem.
In this book is an example how to make shadows. It works by calculating a matrix based on three points that define a plane on which the shadow will fall, and a vector that includes the vertices of the lightsource.
With the resulting matrix the current matrix is multiplied, and then the objects can be drawn flat and in black, as if they were shadows.
The problem is, that the projection of the shadows is on the whole plane, defined by the three points. But I want the shadows only to be drawn on the polygon, that defines the ground.

This can be easily done in several different ways.

Reordering the way things are drawn for instance. Draw the ground, then draw the shadows, then draw everything else.

or

Use the stencil buffer. When drawing ground polygons write some constant to the stencil buffer. Then when everything is drawn, draw the shadows with a stencil test to only draw where the constant is.

or

Use the alpha buffer. When drawing ground polygons, draw them with 0 alpha, but normal blending. Draw everything else with an alpha of 1. Then when drawing the shadows, use a blend function of GL_ONE_MINUS_DST_ALPHA, GL_DST_ALPHA.

or

Clip your shadow polygons to your ground polygons, and retriangulate and draw the resulting triangles.