win32-improve opengl display method, i hope.
This commit is contained in:
parent
eb67250f71
commit
7f7beb6027
|
@ -1433,7 +1433,7 @@ struct GLDISPLAY
|
|||
{
|
||||
//do we need to use another HDC?
|
||||
if(init) return true;
|
||||
init = initContext(MainWindow->getHWnd(),&privateContext, &privateDC);
|
||||
init = initContext(MainWindow->getHWnd(),&privateContext);
|
||||
return init;
|
||||
}
|
||||
|
||||
|
@ -1441,8 +1441,6 @@ struct GLDISPLAY
|
|||
{
|
||||
if(!init) return;
|
||||
wglDeleteContext(privateContext);
|
||||
DeleteObject(privateDC);
|
||||
privateDC = NULL;
|
||||
privateContext = NULL;
|
||||
init = false;
|
||||
}
|
||||
|
@ -1460,11 +1458,18 @@ struct GLDISPLAY
|
|||
if(!initialize()) return false;
|
||||
}
|
||||
|
||||
if(wglGetCurrentContext() != privateContext)
|
||||
privateDC = GetDC(MainWindow->getHWnd());
|
||||
wglMakeCurrent(privateDC,privateContext);
|
||||
return true;
|
||||
}
|
||||
|
||||
void end()
|
||||
{
|
||||
wglMakeCurrent(NULL,privateContext);
|
||||
ReleaseDC(MainWindow->getHWnd(),privateDC);
|
||||
privateDC = NULL;
|
||||
}
|
||||
|
||||
void showPage()
|
||||
{
|
||||
SwapBuffers(privateDC);
|
||||
|
@ -1634,6 +1639,8 @@ static void OGL_DoDisplay()
|
|||
glEnd();
|
||||
|
||||
gldisplay.showPage();
|
||||
|
||||
gldisplay.end();
|
||||
}
|
||||
|
||||
//the directdraw final presentation portion of display, including rotating
|
||||
|
|
|
@ -63,10 +63,9 @@ int CheckHardwareSupport(HDC hdc)
|
|||
return -1; // check error
|
||||
}
|
||||
|
||||
bool initContext(HWND hwnd, HGLRC *hRC, HDC *hdc)
|
||||
bool initContext(HWND hwnd, HGLRC *hRC)
|
||||
{
|
||||
*hRC = NULL;
|
||||
*hdc = NULL;
|
||||
|
||||
HDC oglDC = GetDC (hwnd);
|
||||
|
||||
|
@ -91,7 +90,7 @@ bool initContext(HWND hwnd, HGLRC *hRC, HDC *hdc)
|
|||
return false;
|
||||
}
|
||||
|
||||
*hdc = oglDC;
|
||||
wglMakeCurrent(NULL,NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -18,4 +18,4 @@
|
|||
#pragma once
|
||||
|
||||
bool windows_opengl_init();
|
||||
bool initContext(HWND hwnd, HGLRC *hRC, HDC *hdc);
|
||||
bool initContext(HWND hwnd, HGLRC *hRC);
|
||||
|
|
Loading…
Reference in New Issue