If OpenGL has already been inited, it won't be inited a second time now.

This commit is contained in:
luigi__ 2008-12-28 18:33:36 +00:00
parent bea0b2c795
commit a78eba5604
1 changed files with 6 additions and 0 deletions

View File

@ -7,6 +7,8 @@
extern WINCLASS *MainWindow; extern WINCLASS *MainWindow;
static bool oglAlreadyInit = false;
int CheckHardwareSupport(HDC hdc) int CheckHardwareSupport(HDC hdc)
{ {
int PixelFormat = GetPixelFormat(hdc); int PixelFormat = GetPixelFormat(hdc);
@ -33,6 +35,8 @@ bool windows_opengl_init()
int res; int res;
char *opengl_modes[3]={"software","half hardware (MCD driver)","hardware"}; char *opengl_modes[3]={"software","half hardware (MCD driver)","hardware"};
if(oglAlreadyInit == true) return true;
oglDC = GetDC (MainWindow->getHWnd()); oglDC = GetDC (MainWindow->getHWnd());
memset(&pfd,0, sizeof(PIXELFORMATDESCRIPTOR)); memset(&pfd,0, sizeof(PIXELFORMATDESCRIPTOR));
@ -66,5 +70,7 @@ bool windows_opengl_init()
else else
LOG("OpenGL mode: uknown\n"); LOG("OpenGL mode: uknown\n");
oglAlreadyInit = true;
return true; return true;
} }