summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-04-21 22:57:09 +0200
committerMichael Lutz <michi@icosahedron.de>2021-04-22 21:04:04 +0200
commitef80baf75c20410358a0d39c02b7f76e714abf86 (patch)
tree283ba86c3f521b80ad4eed2c81a92ce92594e01a /src/video
parent9fa38f5d0f3b1bd67028a8d9d5ff06eed1a31cdf (diff)
downloadopenttd-ef80baf75c20410358a0d39c02b7f76e714abf86.tar.xz
Codechange: [Win32] Try getting an OpenGL 4.5 context first before aiming at 3.2.
Diffstat (limited to 'src/video')
-rw-r--r--src/video/win32_v.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 19e186ae2..1dc1db8ce 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -1360,14 +1360,22 @@ const char *VideoDriver_Win32OpenGL::AllocateContext()
/* Create OpenGL device context. Try to get an 3.2+ context if possible. */
if (_wglCreateContextAttribsARB != nullptr) {
+ /* Try for OpenGL 4.5 first. */
int attribs[] = {
- WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
- WGL_CONTEXT_MINOR_VERSION_ARB, 2,
+ WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
+ WGL_CONTEXT_MINOR_VERSION_ARB, 5,
WGL_CONTEXT_FLAGS_ARB, _debug_driver_level >= 8 ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
_hasWGLARBCreateContextProfile ? WGL_CONTEXT_PROFILE_MASK_ARB : 0, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, // Terminate list if WGL_ARB_create_context_profile isn't supported.
0
};
rc = _wglCreateContextAttribsARB(this->dc, nullptr, attribs);
+
+ if (rc == nullptr) {
+ /* Try again for a 3.2 context. */
+ attribs[1] = 3;
+ attribs[3] = 2;
+ rc = _wglCreateContextAttribsARB(this->dc, nullptr, attribs);
+ }
}
if (rc == nullptr) {