win32-refine opengl init code
This commit is contained in:
parent
53756bc480
commit
83b9722276
|
@ -1444,6 +1444,8 @@ struct GLDISPLAY
|
||||||
{
|
{
|
||||||
if(!initialize()) return false;
|
if(!initialize()) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(wglGetCurrentContext() != privateContext)
|
||||||
wglMakeCurrent(privateDC,privateContext);
|
wglMakeCurrent(privateDC,privateContext);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,10 @@ static HWND main_hWND;
|
||||||
|
|
||||||
static bool _begin()
|
static bool _begin()
|
||||||
{
|
{
|
||||||
|
//wglMakeCurrent is slow in some environments. so, check if the desired context is already current
|
||||||
|
if(wglGetCurrentContext() == main_hRC)
|
||||||
|
return true;
|
||||||
|
|
||||||
if(!wglMakeCurrent(main_hDC, main_hRC))
|
if(!wglMakeCurrent(main_hDC, main_hRC))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -126,7 +130,7 @@ static bool makeBootstrapContext()
|
||||||
|
|
||||||
//it seems we may have to specify some non-zero win
|
//it seems we may have to specify some non-zero win
|
||||||
int width, height;
|
int width, height;
|
||||||
width = height = 64; //something safe, but irrelevant
|
width = height = 512; //something safe, but irrelevant. just to be super-safe, lets try making it big enough for the pbuffer we'll make eventually
|
||||||
HWND fakeWindow = CreateWindow("EDIT", 0, 0, 0, 0, width, height, 0, 0, 0, 0);
|
HWND fakeWindow = CreateWindow("EDIT", 0, 0, 0, 0, width, height, 0, 0, 0, 0);
|
||||||
main_hWND = fakeWindow;
|
main_hWND = fakeWindow;
|
||||||
|
|
||||||
|
@ -228,5 +232,8 @@ bool windows_opengl_init()
|
||||||
oglAlreadyInit = true;
|
oglAlreadyInit = true;
|
||||||
oglrender_beginOpenGL = _begin;
|
oglrender_beginOpenGL = _begin;
|
||||||
|
|
||||||
|
//use the new pbuffer context for further extension interrogation in shared opengl init
|
||||||
|
_begin();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue