mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-12 02:09:52 +00:00
Fixed: #981 Create createWindow and destroyWindow private methods in OpenGL driver
This commit is contained in:
parent
ef04c691bb
commit
35b18c4e8e
1 changed files with 15 additions and 14 deletions
|
@ -224,8 +224,10 @@ bool CDriverGL::unInit()
|
||||||
_PBuffer = NULL;
|
_PBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UnregisterClassW(L"NLClass", GetModuleHandle(NULL)))
|
if (_Registered && !UnregisterClassW(L"NLClass", GetModuleHandle(NULL)))
|
||||||
|
{
|
||||||
nlwarning("Can't unregister NLClass");
|
nlwarning("Can't unregister NLClass");
|
||||||
|
}
|
||||||
|
|
||||||
// Restaure monitor color parameters
|
// Restaure monitor color parameters
|
||||||
if (_NeedToRestaureGammaRamp)
|
if (_NeedToRestaureGammaRamp)
|
||||||
|
@ -563,6 +565,10 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
|
||||||
_win = wnd;
|
_win = wnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// associate OpenGL driver to window
|
||||||
|
SetWindowLongPtr(_win, GWLP_USERDATA, (LONG_PTR)this);
|
||||||
|
|
||||||
|
|
||||||
_hDC=GetDC(_win);
|
_hDC=GetDC(_win);
|
||||||
wglMakeCurrent(_hDC,NULL);
|
wglMakeCurrent(_hDC,NULL);
|
||||||
|
|
||||||
|
@ -668,14 +674,14 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
|
||||||
nlerror("glXChooseVisual() failed");
|
nlerror("glXChooseVisual() failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_visual_info = visual_info;
|
||||||
|
|
||||||
_ctx = glXCreateContext (_dpy, visual_info, None, GL_TRUE);
|
_ctx = glXCreateContext (_dpy, visual_info, None, GL_TRUE);
|
||||||
if (_ctx == NULL)
|
if (_ctx == NULL)
|
||||||
{
|
{
|
||||||
nlerror("glXCreateContext() failed");
|
nlerror("glXCreateContext() failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
_visual_info = visual_info;
|
|
||||||
|
|
||||||
if (wnd == EmptyWindow)
|
if (wnd == EmptyWindow)
|
||||||
{
|
{
|
||||||
if (!createWindow(mode))
|
if (!createWindow(mode))
|
||||||
|
@ -922,9 +928,6 @@ bool CDriverGL::createWindow(const GfxMode &mode)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// associate OpenGL driver to window
|
|
||||||
SetWindowLongPtr(window, GWLP_USERDATA, (LONG_PTR)this);
|
|
||||||
|
|
||||||
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
|
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -934,8 +937,11 @@ bool CDriverGL::createWindow(const GfxMode &mode)
|
||||||
if (_visual_info == NULL)
|
if (_visual_info == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
nlWindow root = RootWindow(_dpy, DefaultScreen(_dpy));
|
||||||
|
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
attr.background_pixel = BlackPixel(_dpy, DefaultScreen(_dpy));
|
attr.background_pixel = BlackPixel(_dpy, DefaultScreen(_dpy));
|
||||||
|
attr.colormap = XCreateColormap(_dpy, root, _visual_info->visual, AllocNone);
|
||||||
|
|
||||||
#ifdef XF86VIDMODE
|
#ifdef XF86VIDMODE
|
||||||
// If we're going to attempt fullscreen, we need to set redirect to True,
|
// If we're going to attempt fullscreen, we need to set redirect to True,
|
||||||
|
@ -953,12 +959,7 @@ bool CDriverGL::createWindow(const GfxMode &mode)
|
||||||
attr.override_redirect = False;
|
attr.override_redirect = False;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int attr_flags = CWOverrideRedirect | CWBackPixel;
|
int attr_flags = CWOverrideRedirect | CWBackPixel | CWColormap;
|
||||||
|
|
||||||
nlWindow root = RootWindow(_dpy, DefaultScreen(_dpy));
|
|
||||||
|
|
||||||
attr.colormap = XCreateColormap(_dpy, root, _visual_info->visual, AllocNone);
|
|
||||||
attr_flags |= CWColormap;
|
|
||||||
|
|
||||||
window = XCreateWindow (_dpy, root, 0, 0, mode.Width, mode.Height, 0, _visual_info->depth, InputOutput, _visual_info->visual, attr_flags, &attr);
|
window = XCreateWindow (_dpy, root, 0, 0, mode.Width, mode.Height, 0, _visual_info->depth, InputOutput, _visual_info->visual, attr_flags, &attr);
|
||||||
|
|
||||||
|
@ -1538,8 +1539,8 @@ void CDriverGL::getWindowSize(uint32 &width, uint32 &height)
|
||||||
{
|
{
|
||||||
if (_win)
|
if (_win)
|
||||||
{
|
{
|
||||||
width = (uint32)(_WindowWidth);
|
width = (uint32)_WindowWidth;
|
||||||
height = (uint32)(_WindowHeight);
|
height = (uint32)_WindowHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue