Linux: ensure that a GLCanvas3D can become active before attempting to start OpenGL (fixes #1149)

On Linux, GLEW requires (at least, in EGL land) that an OpenGL context be
active before glew_Init is called -- otherwise, GLEW doesn't know what
extension symbols to look up.  If glew_Init fails, then some symbols
elsewhere will not exist, and the app will shortly crash.  We work around
this by detecting if we're actually ready for postinit, and if not,
resetting the flag so that wxEVT_IDLE will cause us to try again later, when
the window hopefully has gone into the foreground and is ready to be used.
This commit is contained in:
Joshua Wise 2023-01-24 03:02:40 -05:00 committed by Lane.Wei
parent a082ce50ed
commit aa2d692910
3 changed files with 16 additions and 0 deletions

View file

@ -1706,6 +1706,9 @@ float GLCanvas3D::get_collapse_toolbar_height()
return collapse_toolbar.is_enabled() ? collapse_toolbar.get_height() : 0;
}
bool GLCanvas3D::make_current_for_postinit() {
return _set_current();
}
void GLCanvas3D::render(bool only_init)
{