当顶点和顶点索引为空时不绘制

This commit is contained in:
Nanako 2024-11-05 16:55:09 +08:00
parent f73e7e4a50
commit 5220ba6e39
2 changed files with 2 additions and 1 deletions

View File

@ -133,11 +133,11 @@ void dx_window::begin_frame() {
}
context.draw_rectangle({ pos_x, pos_y }, { 1, 100 }, random_color);
pos_x += 1;
if (pos_x >= 1000) {
pos_x = 0;
draw_test = false;
}
pos_x += 1;
}
}

View File

@ -47,6 +47,7 @@ public:
return triangles;
}
void flush() {
if (vertices.empty() || triangles.empty()) return;
if (default_pipeline) {
default_pipeline->set_triangle(vertices, triangles);
default_pipeline->draw();