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

Error creating WebGLContext on Raspberry Pi #118

Open
flimshaw opened this issue Oct 1, 2017 · 3 comments
Open

Error creating WebGLContext on Raspberry Pi #118

flimshaw opened this issue Oct 1, 2017 · 3 comments

Comments

@flimshaw
Copy link

flimshaw commented Oct 1, 2017

After installing the pre-reqs, everything built perfectly on the raspberry pi 3, but I get errors trying to create a webgl context. Is operation on embedded platforms like the raspi possible?

I'm getting the following error:

pi@betty:~ $ noisemaker -o test.png
/usr/lib/node_modules/noisemaker/node_modules/headless-gl/index.js:39
  var gl = new webgl.WebGLRenderingContext(
           ^

Error: Error creating WebGLContext
    at Error (native)
    at createContext (/usr/lib/node_modules/noisemaker/node_modules/headless-gl/index.js:39:12)
    at Object.<anonymous> (/usr/lib/node_modules/noisemaker/index.js:37:34)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:148:18)
    at node.js:405:3

Trying to install and use this npm library: https://www.npmjs.com/package/noisemaker

Thanks a lot, wonderful library!

@samelie
Copy link

samelie commented Apr 28, 2018

increasing GPU memory to 128 solved this.
Running this before node in the same shell also let me use the library as an npm module:

sudo apt-get install xvfb
Xvfb :1 -screen 0 1024x768x24 </dev/null &
export DISPLAY=":1"

@adddog
Copy link

adddog commented Apr 30, 2018

Here is a compiling script for FFMPEG on RP3.

If anyone is interested in piping combining regl with headless-gl in node and piping it into ffmpeg. Have a look at this very_development repo.

This pseudo code is to get the input of ffmpeg to be

 var args = [
    "-f",
    "rawvideo",
    "-pix_fmt",
    "rgba",
    "-s",
    `${options.w}x${options.h}`, // eg: 288x156 (size of regl context)
    "-i",
    "-",
  ]

Write rgba in: ffmpeg.stdin.write(rgbaData, function(err) {}) where ffmpeg is a child_process

And somewhere there is a read on the gl context:
read: (width, height) => gl.read(new Uint8Array(width * height * 4)), // returns rgba data

@SunXinFei
Copy link

increasing GPU memory to 128 solved this. Running this before node in the same shell also let me use the library as an npm module:

sudo apt-get install xvfb
Xvfb :1 -screen 0 1024x768x24 </dev/null &
export DISPLAY=":1"

good job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants