Skip to content

Commit

Permalink
retry wglMakeCurrent up to 5 times on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Jul 24, 2024
1 parent f2f6ffe commit 9bd6cb9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/render_ogl.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ DWORD WINAPI ogl_render_main(void)
Sleep(250);
g_ogl.got_error = g_ogl.use_opengl = FALSE;

BOOL made_current = xwglMakeCurrent(g_ogl.hdc, g_ogl.context);
if (!made_current)
BOOL made_current = FALSE;

for (int i = 0; i < 5; i++)
{
/* make sure we retry at least once */
if ((made_current = xwglMakeCurrent(g_ogl.hdc, g_ogl.context)))
break;

Sleep(50);
made_current = xwglMakeCurrent(g_ogl.hdc, g_ogl.context);
}

if (made_current && glGetError() == GL_NO_ERROR)
Expand Down

0 comments on commit 9bd6cb9

Please sign in to comment.