How to do Texture to an irregular polygon

Could anyone tell me how to do texturing on a 2D Pentagon or any irregular polygon.
How do i make texture co ordinates?

You need to set a (s,t) coordinate with every vertex (x,y,z) that you define. This means use of the glTexCoord* and glVertex* commands. The (s,t) coordinates correspond to your texture; (0,0) is lower left corner and (1,1) is upper right corner.

Details are better explained in Chapter 9 of the Redbook. It may seem daunting to read at first but after understanding this chapter you will be able work with textures. You can get code from this book here. Specifically the sample checker.c would be helpful to look at.

You may get some benefit from running the “texture” example here yourself. It allows you to see the effect of changing the (s,t) and (x,y) parameters interactively.