Hi,
I want to draw rectangle beween two points with arbitary width.when i change starting point or end point rectangle also need to be change.It looks like the below url image https://i.stack.imgur.com/vyQD2.gif. Please any one provide suggestions to how to acheive this.Thanks in advance.

Rajkiran SwainRank #165 · 14.4K reputationPosted Jun 15, 2017, 1:58 AM EDT
We need to calculate 2 values, the shift on the x axis and the shift on the y axis for each of the 4 corners. Which is easy enough.
The dimensions of the line are:
Now the x shift (let's call it xS):
xS = (thickness * height / length of line) / 2 yS = (thickness * width / length of line) / 2To find the length of the line, use Pythagoras's theorem:
length = square_root(width * width + height * height)Now you have the x shift and y shift.
And there you go! (Those coordinates are drawn counterclockwise, the default for OpenGL)