EGL_BAD_CONFIG error when trying to integrate Ogre with Qt

Problems building or running the engine, queries about how to use features etc.
Post Reply
golgobot
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 11:26 pm

EGL_BAD_CONFIG error when trying to integrate Ogre with Qt

Post by golgobot »

I'm trying to get the QmlOgre example here https://github.com/advancingu/QmlOgre to run on an embedded ARM chip. Quoting the README from this project, the way Orge is integrated into Qt is by rendering "Ogre viewports to FBO (Frame Buffer Objects) which are then applied to QML items as textures. Creates an OpenGL context for Ogre which is shared with Qt's QML OpenGL context".

Currently it runs perfectly on desktop Linux with GL renderer.

For the embedded environment I built Ogre with GLES2 and EGL options.

I turned on ENABLE_EGL_CHECK in OgreEGLSupport.h to find the specific EGL error.

Code: Select all

EGL error 0x3005 in void* Ogre::EGLSupport::createNewContext(EGLDisplay, EGLConfig, EGLContext) const at line 504
This is EGL error code EGL_BAD_CONFIG, which, according to khronos means, "An EGLConfig argument does not name a valid EGLConfig."

I am seriously stuck, because there doesn't seem to be a way to get a reason why it's not a valid config. Is there a better way to debug this?

Thanks!

Update:

To provide a concrete project with real code, I ported the above repo to use GLES2. You can find it here https://github.com/golgobot/qmlogre

Looking into it further: Because this is sharing a context with Qt, the EGLConfig is obtained by querying the provided surface using eglQuerySurface. This is obtained in Ogre::EGLSupport::getGLConfigFromDrawable, which takes an EGLSurface and returns an EGLConfig. That config is an argument to eglCreateContext in Ogre::EGLSupport::createNewContext. So how can a config that already exists and is obtained from a valid EGLSurface create a EGL_BAD_CONFIG error?
Last edited by golgobot on Thu Oct 05, 2017 8:39 pm, edited 1 time in total.
golgobot
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 11:26 pm

Re: EGL_BAD_CONFIG error when trying to integrate Ogre with

Post by golgobot »

Ok, to follow up on this error, I can't post the original code that caused this error, so I took the original QmlOgre project and ported it to use GLES2 and I was able to reproduce the issue. I posted the repo here: https://github.com/golgobot/qmlogre.

There's a bunch of GL calls that aren't supported in GLES2 that were used in the original. Those are commented out in the example.

But the issue is that Ogre cannot create a valid context before anything in ogrenode.cpp is called.

The program terminates with this error

Code: Select all

GLES2RenderSystem::_createRenderWindow "OgreWindow", 1x1 windowed  miscParams: currentGLContext=true externalGLControl=true 
terminate called after throwing an instance of 'Ogre::RenderingAPIException'
  what():  RenderingAPIException: Fail to create New context in createNewContext at src/EGL/OgreEGLSupport.cpp (line 510)
Aborted
golgobot
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 11:26 pm

Re: EGL_BAD_CONFIG error when trying to integrate Ogre with

Post by golgobot »

Turns out this is probably a bug in Ogre https://github.com/OGRECave/ogre/issues/530.

Having tried everything I could short of rewriting the GLES2 renderer, I'm giving up and rebuilding everything with GLX.
Post Reply