2 Copyright (c) 2019 The Khronos Group Inc.
3 Use of this source code is governed by an MIT-style license that can be
4 found in the LICENSE.txt file.
10 <meta charset=
"utf-8">
11 <title>Simple Rendering Test
</title>
12 <link rel=
"stylesheet" href=
"../../resources/js-test-style.css"/>
13 <script src=
"../../js/js-test-pre.js"></script>
14 <script src=
"../../js/webgl-test-utils.js"> </script>
17 <canvas id=
"example" width=
"50" height=
"50">
18 There is supposed to be an example drawing here, but it's not important.
20 <div id=
"description"></div>
21 <div id=
"console"></div>
22 <script id=
"vshader" type=
"x-shader/x-vertex">
23 attribute vec4 a_Position;
26 gl_Position = a_Position;
30 <script id=
"fshader" type=
"x-shader/x-fragment">
33 gl_FragColor = vec4(
0,
1,
0,
1);
38 var wtu
= WebGLTestUtils
;
43 var gl
= wtu
.create3DContext("example");
44 var program
= wtu
.loadProgramFromScript(gl
, "vshader", "fshader");
45 gl
.useProgram(program
);
46 var loc
= gl
.getAttribLocation(program
, "a_Position");
48 var vertexObject
= gl
.createBuffer();
49 gl
.bindBuffer(gl
.ARRAY_BUFFER
, vertexObject
);
60 gl
.enableVertexAttribArray(loc
);
61 gl
.vertexAttribPointer(loc
, 2, gl
.FLOAT
, false, 0, 0);
63 gl
.clear(gl
.COLOR_BUFFER_BIT
| gl
.DEPTH_BUFFER_BIT
);
64 wtu
.checkCanvas(gl
, [0,0,0,0], "should be black", 0);
65 gl
.drawArrays(gl
.TRIANGLES
, 0, 6);
66 wtu
.checkCanvas(gl
, [0,255,0,255], "should be green", 0);
68 wtu
.glErrorShouldBe(gl
, gl
.NO_ERROR
, "there should be no errors");
72 var successfullyParsed
= true;
74 <script src=
"../../js/js-test-post.js"></script>