Skip to content

Commit

Permalink
proper
Browse files Browse the repository at this point in the history
  • Loading branch information
yekm committed Jun 21, 2023
1 parent 93f9430 commit 4783177
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 311 deletions.
3 changes: 2 additions & 1 deletion art.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Art {
if (use_pixel_buffer && !pb)
pb = std::make_unique<PixelBuffer>();
tex_w = _w, tex_h = _h;
frame_number = 0;
resize(_w, _h);
}
bool gui() {
Expand Down Expand Up @@ -96,7 +97,7 @@ class Art {

virtual ~Art() = default;

unsigned frame_number = 0, clear_every = 0;
unsigned frame_number = 0, clear_every = 0, max_kframes = 0;
unsigned pixel_buffer_maximum = 1024*10, pixel_buffer_maximum_max = 1024*1024;

void clear() {
Expand Down
3 changes: 3 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ int main(int argc, char *argv[])
{

ScrollableSliderUInt("force clear every N frames", &art->clear_every, 0, 1024, "%d", 1);
ScrollableSliderUInt("Max 1k frames before reinit", &art->max_kframes, 0, 1024, "%d", 1);
ImGui::ColorEdit4("Clear color", (float*)&clear_color);
}

Expand All @@ -212,6 +213,8 @@ int main(int argc, char *argv[])

ImGui::End();

if (art->max_kframes)
resize_pbo |= art->frame_number > art->max_kframes*1024;
if (get_window_size() || resize_pbo) {
art->resized(sw, sh);
destroy_pbos();
Expand Down
Loading

0 comments on commit 4783177

Please sign in to comment.