summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-03-06 15:44:33 +0100
committerGitHub <noreply@github.com>2018-03-06 15:44:33 +0100
commit4f1b87265e1e74b1fdd0aa0aa59a9daf03fd3f40 (patch)
tree8ebf5dc57613554bb8652bf29dbff88e12fce976 /platform/windows
parent2efd7add4a947b2b5dcab072d1f8ee297735088e (diff)
parentad67911f1a45370558f968cdc1540f707534c28f (diff)
Merge pull request #17304 from bruvzg/gl_core_profile
[GL] Explicitly set OpenGL 3.3 profile to Core (X11, Windows) and enable GLES2 on Windows.
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/context_gl_win.cpp3
-rw-r--r--platform/windows/os_windows.cpp16
2 files changed, 15 insertions, 4 deletions
diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp
index 8b57fdd9ce..d312fbcb12 100644
--- a/platform/windows/context_gl_win.cpp
+++ b/platform/windows/context_gl_win.cpp
@@ -38,6 +38,8 @@
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_FLAGS_ARB 0x2094
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
+#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
+#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
typedef HGLRC(APIENTRY *PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC, HGLRC, const int *);
@@ -153,6 +155,7 @@ Error ContextGL_Win::initialize() {
WGL_CONTEXT_MAJOR_VERSION_ARB, 3, //we want a 3.3 context
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
//and it shall be forward compatible so that we can only use up to date functionality
+ WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB /*| _WGL_CONTEXT_DEBUG_BIT_ARB*/,
0
}; //zero indicates the end of the array
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 910010187d..13fe781ff3 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -30,6 +30,7 @@
#include "os_windows.h"
+#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "drivers/windows/dir_access_windows.h"
#include "drivers/windows/file_access_windows.h"
@@ -1069,12 +1070,19 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
}
#if defined(OPENGL_ENABLED)
- gl_context = memnew(ContextGL_Win(hWnd, true));
- gl_context->initialize();
+ if (p_video_driver == VIDEO_DRIVER_GLES2) {
+ gl_context = memnew(ContextGL_Win(hWnd, false));
+ gl_context->initialize();
- RasterizerGLES3::register_config();
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ } else {
+ gl_context = memnew(ContextGL_Win(hWnd, true));
+ gl_context->initialize();
- RasterizerGLES3::make_current();
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ }
gl_context->set_use_vsync(video_mode.use_vsync);
#endif