- glBegin(GL_LINES);
- float seq_start_x = track_container[path_index].x();
- float seq_end_x = track_container[path_index+1].x();
- glVertex3f(s.start.x + seq_start_x, s.start.y, -1);
- glVertex3f(s.end.x + seq_end_x , s.end.y, -1);
- glEnd();
+ float seq_start_x = s.start.x
+ + track_container[path_index]->x();
+ float seq_end_x = s.end.x
+ + track_container[path_index+1]->x();
+ if (s.length <= min_segment_width) {
+ // use lines for elements of length <=1 or < 1 pixel.
+ // and try to center the line
+ const float offset = s.length * 0.5;
+ glBegin(GL_LINES);
+ glVertex3f(seq_start_x+offset, s.start.y, -1);
+ glVertex3f(seq_end_x +offset, s.end.y, -1);
+ glEnd();
+ } else {
+ // otherwise use quads
+ // compute length
+ float seq_start_x_length = s.start.x
+ + s.length
+ + track_container[path_index]->x();
+ float seq_end_x_length = s.end.x
+ + s.length
+ + track_container[path_index+1]->x();
+ glBegin(GL_QUADS);
+ glVertex3f(seq_start_x, s.start.y, zdepth);
+ glVertex3f(seq_end_x, s.end.y, zdepth);
+ glVertex3f(seq_end_x_length, s.end.y, zdepth);
+ glVertex3f(seq_start_x_length, s.start.y, zdepth);
+ glEnd();
+ }