Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GL Context Issues in addon #8848

Closed
tyduptyler13 opened this issue Mar 6, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@tyduptyler13
Copy link

commented Mar 6, 2017

  • Electron version: 1.6.1
  • Operating system: Linux

Expected behavior

I have created a nodejs addon that works inside electron as well. When running against nodejs I can
create a GLFW window with a GLES2 context and use it as expected. When running against electron, a GLFW window is created, the context briefly exists, then as soon as I call a GL function, it behaves as if the context is gone. glGetString(GL_VERSION) returns null immediately after creating the window, and after explicitly making the context current. glGetError also returns 0.

This worked previously just fine in v1.4.15.

How to reproduce

This requires that GLFW3, Electron, and node-gyp are installed on the system.

The build script is also hard coded to build for electron 1.6.1.

git clone https://github.com/MyUPlay/MyEngine
cd MyEngine
make -j8
electron test/core/BasicExample-electron.js

To prove the code works otherwise (from inside the repo):

NODEBUILD=1 make -j8
node test/core/BasicExample.js

The js has to be different, obviously, so that it doesn't call electron to do the UI, which should be the only difference.

@tyduptyler13

This comment has been minimized.

Copy link
Author

commented Mar 15, 2017

Tested in electron 1.6.2 and the issue still exists.

Using a forced downgrade to 1.4.15 until resolved.

@zcbenz

This comment has been minimized.

Copy link
Member

commented Jun 13, 2017

This is very likely related to how Chromium initializes OpenGL, I believe your module is affected by some global states set by Chromium.

I'm closing this because it is an issue of Chromium's GPU rendering, and none of us in Electron team is familiar with that part of code enough to be able to fix this. A pull request to fix it would be welcomed.

@zcbenz zcbenz closed this Jun 13, 2017

@tyduptyler13

This comment has been minimized.

Copy link
Author

commented Jun 20, 2017

I decided to solve this using IPC instead. Its not the prettiest solution, but it will work and will mean I can change dependencies on a whim.

@alexlitty

This comment has been minimized.

Copy link

commented Sep 5, 2017

I submitted an issue with Chromium to get their opinion on the matter. I too suspect this is within Chromium's territory, maybe they can provide deeper insight on the problem's origins.

I'd like to personally pursue this if we can find a reasonable root cause. I see many amazing use-cases if we can get this working.

@tyduptyler13

This comment has been minimized.

Copy link
Author

commented Sep 5, 2017

@alexlitty I would have to definitely agree. I was developing a very lightweight game engine and was using electron/node as the UI and launcher. This was particularly nice since I was using javascript as the runtime scripting language. The project is currently on hold as my job is consuming most of my time but if I ever return to it, it would be really nice to be able to use the latest Electron versions again and avoid IPC if I can.

@ihnorton

This comment has been minimized.

@alexlitty

This comment has been minimized.

Copy link

commented Feb 2, 2018

@zcbenz The Chromium team answered us a little while ago suggesting:

I don't think there is anything actionable from the Chromium side here.

piman's thoughts about the same-process GL bindings is accurate, but Electron separates the rendering process from the browser process -- I would imagine only one of those processes is unsafe to run independent GL code in.

Theoretically I'd think we should be able to run GL code in the browser process. Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.