Browse Source

Fix Window::screenshotModules() after being broken by FramebufferWidget changes.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
8a33dd24b4
1 changed files with 3 additions and 10 deletions
  1. +3
    -10
      src/Window.cpp

+ 3
- 10
src/Window.cpp View File

@@ -547,19 +547,12 @@ void Window::screenshotModules(const std::string& screenshotsDir, float zoom) {
widget::FramebufferWidget* fbw = new widget::FramebufferWidget;
fbw->oversample = 2;

widget::ZoomWidget* zw = new widget::ZoomWidget;
zw->setZoom(zoom);
fbw->addChild(zw);

app::ModuleWidget* mw = model->createModuleWidget(NULL);
zw->box.size = mw->box.size.mult(zoom);
zw->addChild(mw);

// HACK: Set the frame time so FramebufferWidgets are never overdue and therefore guaranteed to draw
internal->frameTime = INFINITY;
fbw->addChild(mw);
fbw->box.size = mw->box.size;

// Draw to framebuffer
fbw->step();
fbw->render(math::Vec(zoom, zoom), math::Vec(0, 0));

// Read pixels
nvgluBindFramebuffer(fbw->getFramebuffer());


Loading…
Cancel
Save