Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Commit 49f1f58

Browse files
authored
Merge pull request #1730 from scribam/egl-glrend
egl: Fix gl4rend init
2 parents 4b1bbe0 + d864867 commit 49f1f58

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

libswirl/utils/glinit/egl/egl.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,22 @@ bool egl_Init(void* wind, void* disp)
118118
}
119119
if (try_full_gl)
120120
{
121-
EGLint contextAttrs[] = { EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
122-
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR,
121+
EGLint contextAttrs[] = { EGL_CONTEXT_MAJOR_VERSION_KHR, 4,
122+
EGL_CONTEXT_MINOR_VERSION_KHR, 3,
123+
#ifndef NDEBUG
124+
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR,
125+
#endif
126+
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
123127
EGL_NONE };
124128
egl_setup.context = eglCreateContext(egl_setup.display, config, NULL, contextAttrs);
129+
if (egl_setup.context == EGL_NO_CONTEXT) {
130+
printf("EGL: Open GL 4.3 not supported\n");
131+
// Try GL 3.0
132+
contextAttrs[1] = 3;
133+
contextAttrs[3] = 0;
134+
egl_setup.context = eglCreateContext(egl_setup.display, config, NULL, contextAttrs);
135+
}
136+
125137
if (egl_setup.context != EGL_NO_CONTEXT)
126138
{
127139
egl_MakeCurrent();

0 commit comments

Comments
 (0)