|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 "use strict"; |
|
4 |
|
5 let isWebGLAvailable; |
|
6 |
|
7 function onWebGLFail() { |
|
8 isWebGLAvailable = false; |
|
9 } |
|
10 |
|
11 function onWebGLSuccess() { |
|
12 isWebGLAvailable = true; |
|
13 } |
|
14 |
|
15 function test() { |
|
16 if (!isWebGLSupported()) { |
|
17 info("Skipping tilt_gl05 because WebGL isn't supported on this hardware."); |
|
18 return; |
|
19 } |
|
20 |
|
21 let canvas = createCanvas(); |
|
22 |
|
23 let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess); |
|
24 let gl = renderer.context; |
|
25 |
|
26 if (!isWebGLAvailable) { |
|
27 return; |
|
28 } |
|
29 |
|
30 |
|
31 let mesh = { |
|
32 vertices: new renderer.VertexBuffer([1, 2, 3], 3), |
|
33 indices: new renderer.IndexBuffer([1]), |
|
34 }; |
|
35 |
|
36 ok(mesh.vertices instanceof TiltGL.VertexBuffer, |
|
37 "The mesh vertices weren't saved at initialization."); |
|
38 ok(mesh.indices instanceof TiltGL.IndexBuffer, |
|
39 "The mesh indices weren't saved at initialization."); |
|
40 } |