1
0
Fork 0

Fix unwanted waypoint list transparency

Ticket: https://sourceforge.net/p/flightgear/codetickets/2009/
This commit is contained in:
James Turner 2018-01-28 15:59:43 +00:00
parent 087995448f
commit f076fe1c1b

View file

@ -358,11 +358,15 @@ void WaypointList::draw( int dx, int dy )
_blink = !_blink; _blink = !_blink;
} }
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
GLint sx = (int) abox.min[0], GLint sx = (int) abox.min[0],
sy = abox.min[1]; sy = abox.min[1];
GLsizei w = (GLsizei) abox.max[0] - abox.min[0], GLsizei w = (GLsizei) abox.max[0] - abox.min[0],
h = _heightPx; h = _heightPx;
sx += border_thickness; sx += border_thickness;
sy += border_thickness; sy += border_thickness;
@ -371,7 +375,7 @@ void WaypointList::draw( int dx, int dy )
glScissor(sx + dx, sy + dy, w, h); glScissor(sx + dx, sy + dy, w, h);
int row = firstVisibleRow(), int row = firstVisibleRow(),
final = lastVisibleRow(), finalRow = lastVisibleRow(),
rowHeight = rowHeightPx(), rowHeight = rowHeightPx(),
y = rowHeight; y = rowHeight;
@ -381,7 +385,7 @@ void WaypointList::draw( int dx, int dy )
RoutePath path(_model->flightplan()); RoutePath path(_model->flightplan());
for ( ; row <= final; ++row, y += rowHeight) { for ( ; row <= finalRow; ++row, y += rowHeight) {
drawRow(dx, dy, row, y, path); drawRow(dx, dy, row, y, path);
} // of row drawing iteration } // of row drawing iteration
@ -395,10 +399,13 @@ void WaypointList::draw( int dx, int dy )
glColor4f(1.0f, 0.5f, 0.0f, 0.8f); glColor4f(1.0f, 0.5f, 0.0f, 0.8f);
glLineWidth(3.0f); glLineWidth(3.0f);
glBegin(GL_LINES); glBegin(GL_LINES);
glVertex2f(dx + abox.min[0], dy + abox.max[1] - insertY); glVertex2f(dx + abox.min[0], dy + abox.max[1] - insertY);
glVertex2f(dx + abox.max[0], dy + abox.max[1] - insertY); glVertex2f(dx + abox.max[0], dy + abox.max[1] - insertY);
glEnd(); glEnd();
} }
glDisable(GL_BLEND);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
} }
void WaypointList::drawRow(int dx, int dy, int rowIndex, int y, void WaypointList::drawRow(int dx, int dy, int rowIndex, int y,