Skip to content

Commit

Permalink
Windows Port: Fix OpenGL renderer init failure. (Regression from commit
Browse files Browse the repository at this point in the history
76fe5f7. Fixes #810.)
  • Loading branch information
rogerman committed Jul 15, 2024
1 parent 241ca96 commit de62116
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions desmume/src/frontend/windows/ogl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static HGLRC main_hRC;
static HDC main_hDC;
static HWND main_hWND;

static bool _begin()
static bool wgl_beginOpenGL()
{
//wglMakeCurrent is slow in some environments. so, check if the desired context is already current
if(wglGetCurrentContext() == main_hRC)
Expand All @@ -110,6 +110,11 @@ static bool _begin()
return true;
}

static bool wgl_endOpenGL()
{
// Do nothing.
}

static bool makeBootstrapContext()
{
//not sure how relevant all this is, since it is just a context for bootstrapping, but we may as well make it as normal as we can, just to be safe
Expand Down Expand Up @@ -227,10 +232,10 @@ bool windows_opengl_init()
main_hDC = hdc;
main_hRC = hGlRc;
oglAlreadyInit = true;
oglrender_beginOpenGL = _begin;

oglrender_beginOpenGL = &wgl_beginOpenGL;
oglrender_endOpenGL = &wgl_endOpenGL;
//use the new pbuffer context for further extension interrogation in shared opengl init
_begin();
wgl_beginOpenGL();

return true;
}

0 comments on commit de62116

Please sign in to comment.