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_gl08 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: let t = new renderer.Texture({ michael@0: source: canvas, michael@0: format: "RGB" michael@0: }); michael@0: michael@0: ok(t instanceof TiltGL.Texture, michael@0: "The texture object wasn't instantiated correctly."); michael@0: michael@0: ok(t._ref, michael@0: "The texture WebGL object wasn't created properly."); michael@0: isnot(t._id, -1, michael@0: "The texture id wasn't set properly."); michael@0: isnot(t.width, -1, michael@0: "The texture width wasn't set properly."); michael@0: isnot(t.height, -1, michael@0: "The texture height wasn't set properly."); michael@0: ok(t.loaded, michael@0: "The texture loaded flag wasn't set to true as it should."); michael@0: }