Skip to content

Commit 9eb9b13

Browse files
authored
Merge pull request #181 from stackgl/node-12-ci-fixes_simplified
Fix macOS CI by pinning NODE_VERSION to 12.13.0
2 parents c192b71 + 7084613 commit 9eb9b13

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ matrix:
1111
dist: trusty
1212
compiler: g++
1313
env:
14-
- NODE_VERSION=12
14+
- NODE_VERSION=12.13.0
1515
- os: osx
1616
osx_image: xcode7
1717
compiler: clang
1818
env:
19-
- NODE_VERSION=12
19+
- NODE_VERSION=12.13.0
2020
addons:
2121
apt:
2222
sources:
@@ -31,8 +31,6 @@ addons:
3131
- libgl1-mesa-dri
3232
- libglapi-mesa
3333
- libosmesa6
34-
cache:
35-
npm: false
3634
before_install:
3735
- ./scripts/before_install.sh
3836
install:

README.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
[![Appveyor](https://ci.appveyor.com/api/projects/status/g5ypwyffmtg1iu83/branch/master?svg=true)](https://ci.appveyor.com/project/dhritzkiv/headless-gl)
55
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
66

7-
`gl` lets you create a WebGL context in [node.js](https://nodejs.org/en/) without making a window or loading a full browser environment.
7+
`gl` lets you create a WebGL context in [Node.js](https://nodejs.org/en/) without making a window or loading a full browser environment.
88

99
It aspires to fully conform to the [WebGL 1.0.3 specification](https://www.khronos.org/registry/webgl/specs/1.0.3/).
1010

1111
## Warning!
1212

13-
This module is not actively developed. It's maintained enough to be working on all recent Node versions, but is unlikely to get new features or substantial bug fixes. If you want to take over the maintenance, please let us know in your pull requests!
13+
This module is not actively developed. It's maintained enough to be working on [all current active and LTS Node.js releases,](https://nodejs.org/en/about/releases/) but is unlikely to get new features or substantial bug fixes. If you want to take over or assist with maintenance, please let us know in a pull request!
1414

1515
## Example
1616

1717
```javascript
18-
//Create context
18+
// Create context
1919
var width = 64
2020
var height = 64
2121
var gl = require('gl')(width, height, { preserveDrawingBuffer: true })
@@ -28,32 +28,41 @@ gl.clear(gl.COLOR_BUFFER_BIT)
2828
var pixels = new Uint8Array(width * height * 4)
2929
gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels)
3030
process.stdout.write(['P3\n# gl.ppm\n', width, " ", height, '\n255\n'].join(''))
31-
for(var i=0; i<pixels.length; i+=4) {
32-
for(var j=0; j<3; ++j) {
33-
process.stdout.write(pixels[i+j] + ' ')
31+
32+
for(var i = 0; i < pixels.length; i += 4) {
33+
for(var j = 0; j < 3; ++j) {
34+
process.stdout.write(pixels[i + j] + ' ')
3435
}
3536
}
3637
```
3738

3839
## Install
39-
Installing `headless-gl` on a supported platform is a snap using one of the prebuilt binaries. Using [npm](https://www.npmjs.com/) run the command,
40+
Installing `headless-gl` on a supported platform is a snap using one of the prebuilt binaries. Using [npm](https://www.npmjs.com/) run the command,
4041

4142
```
4243
npm install gl
4344
```
4445

4546
And you are good to go! If your system is not supported, then please see the [development](#system-dependencies) section on how to configure your build environment. Patches to improve support are always welcome!
4647

48+
## Supported platforms and Node.js versions
49+
50+
gl runs on Linux, macOS, and Windows.
51+
52+
Node.js versions 8 and up are supported. **Note: due to an inadvertant low-level breaking change in libuv's process handling code, this package doesn't return a gl context when running nodejs version 12.13.1 and higher on macOS. A fix will be released in a future version of Node.js. Other platforms are unaffected.**
53+
54+
To support Node.js versions less than 8, use version 4.2.2 of this package.
55+
4756
## API
4857

4958
`headless-gl` exports exactly one function which you can use to create a WebGL context,
5059

51-
#### `var gl = require('gl')(width, height[, options])`
52-
Creates a new `WebGLRenderingContext` with the given parameters.
60+
#### `var gl = require('gl')(width, height[, contextAttributes])`
61+
Creates a new `WebGLRenderingContext` with the given context attributes.
5362

5463
* `width` is the width of the drawing buffer
5564
* `height` is the height of the drawing buffer
56-
* `options` is an optional object whose properties are the context attributes for the WebGLRendering context
65+
* `contextAttributes` is an optional object whose properties are the [context attributes for the WebGLRendering context](https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.2)
5766

5867
**Returns** A new `WebGLRenderingContext` object
5968

@@ -147,7 +156,6 @@ $ sudo apt-get install -y build-essential libxi-dev libglu1-mesa-dev libglew-dev
147156
* [Python 2.7](https://www.python.org/)
148157
* [Microsoft Visual Studio](https://www.microsoft.com/en-us/download/details.aspx?id=5555)
149158
* d3dcompiler_47.dll should be in c:\windows\system32, but if isn't then you can find another copy in the deps/ folder
150-
* (optional) A modern nodejs supporting es6 to run some examples https://iojs.org/en/es6.html
151159

152160
## FAQ
153161

@@ -173,7 +181,7 @@ addons:
173181
- libglapi-mesa
174182
- libosmesa6
175183
node_js:
176-
- '6'
184+
- '8'
177185
before_script:
178186
- export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start
179187
```
@@ -187,7 +195,7 @@ If you are running your own minimal Linux server, such as the one one would want
187195
1. [Xvfb](https://en.wikipedia.org/wiki/Xvfb) is a lightweight X11 server which provides a back buffer for displaying X11 application offscreen and reading back the pixels which were drawn offscreen. It is typically used in Continuous Integration systems. It can be installed on CentOS with `yum install -y Xvfb`, and comes preinstalled on Ubuntu.
188196
2. [Mesa](http://www.mesa3d.org/intro.html) is the reference open source software implementation of OpenGL. It can be installed on CentOS with `yum install -y mesa-dri-drivers`, or `apt-get install libgl1-mesa-dev`. Since a cloud Linux instance will typically run on a machine that does not have a GPU, a software implementation of OpenGL will be required.
189197

190-
Interacting with `Xvfb` requires you to start it on the background and to execute your `node` program with the DISPLAY environment variable set to whatever was configured when running Xvfb (the default being :99). If you want to do that reliably you'll have to start Xvfb from an init.d script at boot time, which is extra configuration burden. Fortunately there is a wrapper script shipped with Xvfb known as `xvfb-run` which can start Xvfb on the fly, execute your node program and finally shut Xvfb down. Here's how to run it:
198+
Interacting with `Xvfb` requires you to start it on the background and to execute your `node` program with the DISPLAY environment variable set to whatever was configured when running Xvfb (the default being :99). If you want to do that reliably you'll have to start Xvfb from an init.d script at boot time, which is extra configuration burden. Fortunately there is a wrapper script shipped with Xvfb known as `xvfb-run` which can start Xvfb on the fly, execute your Node.js program and finally shut Xvfb down. Here's how to run it:
191199

192200
xvfb-run -s "-ac -screen 0 1280x1024x24" <node program>
193201

@@ -197,7 +205,7 @@ Yes, with [browserify](http://browserify.org/). The `STACKGL_destroy_context` a
197205

198206
### How are `<image>` and `<video>` elements implemented?
199207

200-
They aren't for now. If you want to upload data to a texture, you will need to unpack the pixels into a `Uint8Array` and feed it into `texImage2D`. To help reading and saving images, you should check out the following modules:
208+
They aren't for now. If you want to upload data to a texture, you will need to unpack the pixels into a `Uint8Array` and feed it into `texImage2D`. To help reading and saving images, you should check out the following modules:
201209

202210
* [`get-pixels`](https://www.npmjs.com/package/get-pixels)
203211
* [`save-pixels`](https://www.npmjs.com/package/save-pixels)
@@ -240,7 +248,7 @@ After you have your [system dependencies installed](#system-dependencies), do th
240248

241249
Once this is done, you should be good to go! A few more things
242250

243-
* To run the test cases, use the command `npm test`, or execute specific by just running it using node.
251+
* To run the test cases, use the command `npm test`, or execute specific tests by just running them using `node`.
244252
* On a Unix-like platform, you can do incremental rebuilds by going into the `build/` directory and running `make`. This is **way faster** running `npm build` each time you make a change.
245253

246254
## License

scripts/test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ else
99
source ~/.bashrc
1010
fi
1111

12+
nvm install ${NODE_VERSION}
13+
nvm alias default ${NODE_VERSION}
14+
1215
node --version
1316
npm --version
1417

0 commit comments

Comments
 (0)