Drawing shadows around rectangle using Open GL using C

  2d, c++, linux, opengl

I am new to Open GL, i am trying to create a rectangle with shadow around it. i have searched over the internet and found some docs which produces shadow using following methods:

  1. Drawing Multiple rectangles with different alpha values
  2. Using Shaders to create shadow

I am not good at Open GL,here is the sample picture of what i need to achieve.
Shadow Sample

Is there any sample codes to achieve it ?

Source: Windows Questions C++