Draw Shapes With Mouse Drag

Hy,
I want to draw shapes like rectangle, circle, triangle etc with mouse drag like in MS paint ? I know some functions like glutMotionFunc(xxxxxx)
glutMouseFunc(xxxx)
but don’t understanding it how i draw these shapes dynamically ?

Please help me . . .
Thanks in advance