I am trying to create a line in opengl using multiple points.
if i use these points 0:0:0 25:25:0 50:0:0
than this is the output of the line
The line has a issue the edge points are not connected , how can i connect the end points.
This is the code where the data is generated for the line using two points.
void Boundary::DrawLine(Point p1, Point p2)
 {
     float dx, dy, dist, x1, y1, x2, y2, x3, y3, x4, y4, n;
     dx = p1.x - p2.x;
     dy = p1.y - p2.y;
     n = 2;
     dist = sqrt(dx * dx + dy * dy);
     dx /= dist;
     dy /= dist;
     x1 = p1.x + (n / 2) * dy;
     y1 = p1.y - (n / 2) * dx;
     x2 = p1.x - (n / 2) * dy;
     y2 = p1.y + (n / 2) * dx;
     x3 = p2.x + (n / 2) * dy;
     y3 = p2.y - (n / 2) * dx;
     x4 = p2.x - (n / 2) * dy;
     y4 = p2.y + (n / 2) * dx;
         // data for the line
         float vertices[] = {
                x2, y2, 0.0,
                 x4, y4, 0.0,
                 x1, y1, 0.0,
                 x3, y3, 0.0
                 }; 
     
 }
This is the draw function where stdvecPoints is a vector of structure Point,
void Boundary::Draw()
 {
     for (int i = 0; i < stdvecPoints.size() - 1; i++) {
         DrawLine(stdvecPoints[i], stdvecPoints[i + 1]);
     }
 }


