From 4f9104a84db7211950a9290db113b37ba1dc1348 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?= <tmueller@nvidia.com>
Date: Thu, 9 Feb 2023 09:42:56 +0100
Subject: [PATCH] Fix single-frame lag of `testbed.screenshot()`

---
 src/python_api.cu | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/python_api.cu b/src/python_api.cu
index bca3621..d1f4fee 100644
--- a/src/python_api.cu
+++ b/src/python_api.cu
@@ -208,6 +208,7 @@ py::array_t<float> Testbed::render_to_cpu(int width, int height, int spp, bool l
 #ifdef NGP_GUI
 py::array_t<float> Testbed::screenshot(bool linear) const {
 	std::vector<float> tmp(m_window_res.prod() * 4);
+	glReadBuffer(GL_FRONT);
 	glReadPixels(0, 0, m_window_res.x(), m_window_res.y(), GL_RGBA, GL_FLOAT, tmp.data());
 
 	py::array_t<float> result({m_window_res.y(), m_window_res.x(), 4});
-- 
GitLab