projective texture mapping and shadow mapping

I am trying to implement projective texture mapping in opengl. Suppose there is a projector ,which project a image onto the model. Hopfully,I need only front side can be painted by image and back side should be occluded. How to do that?

Could anyone help me about that?

Look at the diagram on this page under Projective Texturing:

Read the text for more details on how it works.

Of course nowadays you wouldn’t use the fixed-function texture coordinate generation (GL_TEXTURE_GEN* stuff) … you’d just pass the matrix into a shader uniform and use it directly in your shader math to generate the texture coordinates. Simpler.