diff --git a/engine/canvas.cpp b/engine/canvas.cpp index 460ed94..9fcf02c 100644 --- a/engine/canvas.cpp +++ b/engine/canvas.cpp @@ -1270,11 +1270,11 @@ void ui::Canvas::export_cubes(std::string data_path) const int stride = m_width * 4; auto buffer = std::make_unique(m_width * m_height * 4); auto flipped = std::make_unique(m_width * m_height * 4); - for (auto i : m_order) + for (int layer = 0; layer < m_order.size(); layer++) { for (int plane = 0; plane < 6; plane++) { - auto& l = m_layers[i]; + auto& l = m_layers[m_order[layer]]; l.m_rtt[plane].bindFramebuffer(); glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, buffer.get()); l.m_rtt[plane].unbindFramebuffer(); @@ -1305,7 +1305,7 @@ void ui::Canvas::export_cubes(std::string data_path) } static char name[128]; - sprintf(name, "%s-%02d-%d.png", data_path.c_str(), i, plane); + sprintf(name, "%s-%02d-%d.png", data_path.c_str(), layer, plane); int ret = stbi_write_png(name, m_width, m_height, 4, buffer.get(), 0);