How can I make a canvas with WebGL enabled on an Ubuntu server?

I have a program that uses devtool to launch a browser without a header that displays a canvas element, converts it to a base64 image, then saves it to disk. I would like this launch to be done on aws G2 Ubuntu server with NVIDIA graphics cards.

To run the program, I use xvfb for the virtual frame buffer. The command is as follows:

 xvfb-run --server-args="-screen 0 1024x768x24" devtool main.js -i index.html -h -c 

The problem I am facing is related to WebGL support. Under the hood, devtool uses electron to create a browser context. On my OSX machine, this works fine. But on the server, this gives me a couple of errors:

 Xlib: extension "RANDR" missing on display ":9.0" 

and

 [5331:0127/180654:ERROR:sandbox_linux.cc(338)] InitializeSandbox() called with multiple threads in process gpu-process 

I have several troubleshooting methods. For RANDR, I tried to enable it using +extension RANDR using devtool.

I tried to enable the experimentalFeatures flag for electron (in devtool source code) with WebGL support. I used the disable-gpu , disable-gpu-sandbox and ignore-gpu-blacklist functions.

Any help would be greatly appreciated, or if you have an idea to do what I do, I would love to hear it!

+5
source share

Source: https://habr.com/ru/post/1241672/


All Articles