Skip to content

Commit b99960c

Browse files
Merge pull request #262 from gpujs/261-webgl2
261 - webgl2
2 parents d1ce3da + af7060d commit b99960c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+7524
-1672
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Note: To animate the rendering, use `requestAnimationFrame` instead of `setTimeo
206206
Currently, if you need alpha do something like enabling `premultipliedAlpha` with your own gl context:
207207
```js
208208
const canvas = DOM.canvas(500, 500);
209-
const gl = canvas.getContext('webgl', { premultipliedAlpha: false });
209+
const gl = canvas.getContext('webgl2', { premultipliedAlpha: false });
210210

211211
const gpu = new GPU({
212212
canvas,

bin/gpu-core.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*
55
* GPU Accelerated JavaScript
66
*
7-
* @version 1.0.6
8-
* @date Tue Mar 06 2018 19:26:37 GMT-0500 (EST)
7+
* @version 1.2.0
8+
* @date Thu Mar 08 2018 17:26:16 GMT-0500 (EST)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -171,6 +171,24 @@ var UtilsCore = function () {
171171

172172
return webGl;
173173
}
174+
175+
176+
}, {
177+
key: 'initWebGl2',
178+
value: function initWebGl2(canvasObj) {
179+
180+
if (typeof _isCanvasSupported !== 'undefined' || canvasObj === null) {
181+
if (!_isCanvasSupported) {
182+
return null;
183+
}
184+
}
185+
186+
if (!UtilsCore.isCanvas(canvasObj)) {
187+
throw new Error('Invalid canvas object - ' + canvasObj);
188+
}
189+
190+
return canvasObj.getContext('webgl2', UtilsCore.initWebGlDefaultOptions());
191+
}
174192
}]);
175193

176194
return UtilsCore;

bin/gpu-core.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)