Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lib/aux_vis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,20 @@ int Screenshot(const char *fname, bool convert)

int w, h;
wnd->getGLDrawSize(w, h);
if (wnd->isSwapPending())
// Headless EGL/CGL windows render into an FBO.
// GL_BACK/GL_FRONT are not valid read buffers there and leave a
// sticky GL error that later asserts in EglWindow::getGLDrawSize.
GLint bound_fbo = 0;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &bound_fbo);
if (bound_fbo != 0)
{
#ifdef GLVIS_DEBUG
cerr << "Screenshot: reading image data from color attachment 0..."
<< endl;
#endif
glReadBuffer(GL_COLOR_ATTACHMENT0);
}
else if (wnd->isSwapPending())
{
#ifdef GLVIS_DEBUG
cerr << "Screenshot: reading image data from back buffer..." << endl;
Expand Down
Loading