diff --git a/src/main.cpp b/src/main.cpp index f37a363..e88dd32 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -40,7 +40,7 @@ struct kdtree void draw() { - DrawRectangleLines(aabb_min.x, aabb_min.y, aabb_size.x, aabb_size.y, BLACK); + DrawRectangleLines(aabb_min.x, aabb_min.y, aabb_size.x, aabb_size.y, WHITE); if(left && right) { left->draw(); @@ -75,6 +75,7 @@ int main (int argc, char *argv[]) std::vector pts; + for (int i = 0; i < img.width * img.height; ++i) { int x = i % img.width; @@ -115,13 +116,16 @@ int main (int argc, char *argv[]) kdtree tree(pts); - while (!WindowShouldClose()) - { - BeginDrawing(); - ClearBackground(WHITE); - tree.draw(); - EndDrawing(); - } + auto target = LoadRenderTexture(img.width, img.height); + + BeginTextureMode(target); + ClearBackground(BLACK); + tree.draw(); + EndTextureMode(); + + auto t = LoadImageFromTexture(target.texture); + ImageFlipVertical(&t); + ExportImage(t, "test.jpg"); CloseWindow();