michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: "use strict"; michael@0: michael@0: let isWebGLAvailable; michael@0: michael@0: function onWebGLFail() { michael@0: isWebGLAvailable = false; michael@0: } michael@0: michael@0: function onWebGLSuccess() { michael@0: isWebGLAvailable = true; michael@0: } michael@0: michael@0: function test() { michael@0: if (!isWebGLSupported()) { michael@0: info("Skipping tilt_gl02 because WebGL isn't supported on this hardware."); michael@0: return; michael@0: } michael@0: michael@0: let canvas = createCanvas(); michael@0: michael@0: let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess); michael@0: let gl = renderer.context; michael@0: michael@0: if (!isWebGLAvailable) { michael@0: return; michael@0: } michael@0: michael@0: michael@0: renderer.fill([1, 0, 0, 1]); michael@0: ok(isApproxVec(renderer._fillColor, [1, 0, 0, 1]), michael@0: "The fill color wasn't set correctly."); michael@0: michael@0: renderer.stroke([0, 1, 0, 1]); michael@0: ok(isApproxVec(renderer._strokeColor, [0, 1, 0, 1]), michael@0: "The stroke color wasn't set correctly."); michael@0: michael@0: renderer.strokeWeight(2); michael@0: is(renderer._strokeWeightValue, 2, michael@0: "The stroke weight wasn't set correctly."); michael@0: is(gl.getParameter(gl.LINE_WIDTH), 2, michael@0: "The stroke weight wasn't applied correctly."); michael@0: }