From 254deaee9af88649df37236ecae48631ff52027d Mon Sep 17 00:00:00 2001 From: Mr F Date: Tue, 2 Aug 2016 11:19:54 +0300 Subject: [PATCH] fix crash when not supplying options to device --- src/graphics/device.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/graphics/device.js b/src/graphics/device.js index 2c6a0e43afc..b6c5b6ff65b 100644 --- a/src/graphics/device.js +++ b/src/graphics/device.js @@ -29,6 +29,8 @@ pc.extend(pc, function () { var _createContext = function (canvas, options) { var names = ["webgl", "experimental-webgl"]; var context = null; + options = options || {}; + options.stencil = true; for (var i = 0; i < names.length; i++) { try { context = canvas.getContext(names[i], options); @@ -219,7 +221,6 @@ pc.extend(pc, function () { // Retrieve the WebGL context if (canvas) { - options.stencil = true; this.gl = _createContext(canvas, options); }