When using GLES on desktop, use same API for child context. Closes #2612

This commit is contained in:
baldurk
2022-06-16 15:25:54 +01:00
parent fc39299da8
commit 59804c1d1e
2 changed files with 16 additions and 3 deletions
+6 -1
View File
@@ -50,6 +50,8 @@ void *GetGLHandle()
class GLXPlatform : public GLPlatform
{
RDCDriver m_API = RDCDriver::OpenGLES;
bool MakeContextCurrent(GLWindowingData data)
{
if(GLX.glXMakeCurrent)
@@ -241,7 +243,8 @@ class GLXPlatform : public GLPlatform
attribs[i++] = 0;
#endif
attribs[i++] = GLX_CONTEXT_PROFILE_MASK_ARB;
attribs[i++] = GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
attribs[i++] = m_API == RDCDriver::OpenGLES ? GLX_CONTEXT_ES2_PROFILE_BIT_EXT
: GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
GLXContext ctx = GLX.glXCreateContextAttribsARB(dpy, fbcfg[0], share_context.ctx, true, attribs);
@@ -342,6 +345,8 @@ class GLXPlatform : public GLPlatform
RDCASSERT(api == RDCDriver::OpenGL || api == RDCDriver::OpenGLES);
m_API = api;
int attribs[64] = {0};
int i = 0;
+10 -2
View File
@@ -29,6 +29,8 @@
class WGLPlatform : public GLPlatform
{
RDCDriver m_API = RDCDriver::OpenGLES;
bool MakeContextCurrent(GLWindowingData data)
{
if(WGL.wglMakeCurrent)
@@ -108,6 +110,9 @@ class WGLPlatform : public GLPlatform
SetPixelFormat(dc, pf, &pfd);
int profile = m_API == RDCDriver::OpenGLES ? WGL_CONTEXT_ES2_PROFILE_BIT_EXT
: WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
const int attribs[] = {
WGL_CONTEXT_MAJOR_VERSION_ARB,
3,
@@ -116,7 +121,7 @@ class WGLPlatform : public GLPlatform
WGL_CONTEXT_FLAGS_ARB,
0,
WGL_CONTEXT_PROFILE_MASK_ARB,
WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
profile,
0,
0,
};
@@ -289,7 +294,8 @@ class WGLPlatform : public GLPlatform
attribs[i++] = 0;
#endif
attribs[i++] = WGL_CONTEXT_PROFILE_MASK_ARB;
attribs[i++] = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
attribs[i++] = m_API == RDCDriver::OpenGLES ? WGL_CONTEXT_ES2_PROFILE_BIT_EXT
: WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
HGLRC rc = WGL.wglCreateContextAttribsARB(DC, share_context.ctx, attribs);
if(rc == NULL)
@@ -374,6 +380,8 @@ class WGLPlatform : public GLPlatform
RDCASSERT(api == RDCDriver::OpenGL || api == RDCDriver::OpenGLES);
m_API = api;
bool success = RegisterClass();
if(!success)