I've created an C++ & OpenGL animation engine backed by GLX and GLEW, wrapped in a Node.js module via SWIG. The goal is to use the engine inside an Electron app in the browser process.
The engine appears quite stable. It's multi-context aware, binding the correct OpenGL context before all relevant operations, checking for errors after almost every possible operation, and backed by a rather large testing suite.
Outside of an electron app everything is working just fine. Mysteriously however, simple scripts that would normally work outside of Electron are failing inside an Electron app in either browser or renderer process.
Symptoms
- Anything generated by
glGenX
is returning 0 glGetString(GL_VERSION)
returns null, afterwardglGetError
returns no error
Facts
In this order:
- The OpenGL context is created with
glXCreateContextAttribsARB
with a reasonable FB config. The returned value is non-zero. XSync(display, false)
is being called to wait for X errors. No errors are crashing the program, setting an X error handler yields no results.- The context is made current with
glXMakeCurrent
, no errors reported byglGetError
. - The context is direct, checked with
glXIsDirect
. - GLEW is initialized with
glewInit
, returningGLEW_OK
. - The actions in this case are occurring within the same thread. In the Electron app, the context is made and immediately used in the same process; The creation of the context itself queries the version within the same method. Same symptoms before and after the Electron app is 'ready'.
I'm pretty baffled by this. Everything I'm checking appears to suggest the context was created correctly but it otherwise appears corrupted or dysfunctional.
What's going on? What else can I check?