1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-25 17:53:47 +00:00

don't quadruple overdraw points in grid debug render

This commit is contained in:
fgenesis 2023-07-20 22:27:50 +02:00
parent 4b2008d06b
commit bc3dfdb9a3

View file

@ -202,17 +202,13 @@ void RenderGrid::renderDebugPoints(const RenderState& rs) const
glPointSize(2);
glColor3f(1,0,0);
glBegin(GL_POINTS);
const size_t NX = grid.width()-1;
const size_t NY = grid.height()-1;
for (size_t y = 0; y < NY; y++)
const size_t W = grid.width();
const size_t H = grid.height();
for (size_t y = 0; y < H; y++)
{
for (size_t x = 0; x < NX; x++)
{
glVertex2f(grid(x,y).x, grid(x,y).y);
glVertex2f(grid(x,y+1).x, grid(x,y+1).y);
glVertex2f(grid(x+1,y+1).x, grid(x+1,y+1).y);
glVertex2f(grid(x+1,y).x, grid(x+1,y).y);
}
const Vector * const row = grid.row(y);
for (size_t x = 0; x < W; x++)
glVertex2f(row[x].x, row[x].y);
}
glEnd();
}