Merge branch 'master' into jgrpp
# Conflicts: # src/lang/korean.txt # src/settings.cpp
This commit is contained in:
@@ -1295,7 +1295,6 @@ const char *VideoDriver_Win32OpenGL::Start(const StringList ¶m)
|
||||
if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) return "Only real blitters supported";
|
||||
|
||||
Dimension old_res = _cur_resolution; // Save current screen resolution in case of errors, as MakeWindow invalidates it.
|
||||
this->vsync = GetDriverParamBool(param, "vsync");
|
||||
|
||||
LoadWGLExtensions();
|
||||
|
||||
@@ -1311,6 +1310,12 @@ const char *VideoDriver_Win32OpenGL::Start(const StringList ¶m)
|
||||
}
|
||||
|
||||
this->ClientSizeChanged(this->width, this->height, true);
|
||||
/* We should have a valid screen buffer now. If not, something went wrong and we should abort. */
|
||||
if (_screen.dst_ptr == nullptr) {
|
||||
this->Stop();
|
||||
_cur_resolution = old_res;
|
||||
return "Can't get pointer to screen buffer";
|
||||
}
|
||||
|
||||
MarkWholeScreenDirty();
|
||||
|
||||
@@ -1340,6 +1345,15 @@ void VideoDriver_Win32OpenGL::DestroyContext()
|
||||
}
|
||||
}
|
||||
|
||||
void VideoDriver_Win32OpenGL::ToggleVsync(bool vsync)
|
||||
{
|
||||
if (_wglSwapIntervalEXT != nullptr) {
|
||||
_wglSwapIntervalEXT(vsync);
|
||||
} else if (vsync) {
|
||||
DEBUG(driver, 0, "OpenGL: Vsync requested, but not supported by driver");
|
||||
}
|
||||
}
|
||||
|
||||
const char *VideoDriver_Win32OpenGL::AllocateContext()
|
||||
{
|
||||
this->dc = GetDC(this->main_wnd);
|
||||
@@ -1368,12 +1382,7 @@ const char *VideoDriver_Win32OpenGL::AllocateContext()
|
||||
}
|
||||
if (!wglMakeCurrent(this->dc, rc)) return "Can't active GL context";
|
||||
|
||||
/* Enable/disable Vsync if supported. */
|
||||
if (_wglSwapIntervalEXT != nullptr) {
|
||||
_wglSwapIntervalEXT(this->vsync ? 1 : 0);
|
||||
} else if (vsync) {
|
||||
DEBUG(driver, 0, "OpenGL: Vsync requested, but not supported by driver");
|
||||
}
|
||||
this->ToggleVsync(_video_vsync);
|
||||
|
||||
this->gl_rc = rc;
|
||||
return OpenGLBackend::Create(&GetOGLProcAddressCallback);
|
||||
|
||||
Reference in New Issue
Block a user