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>WebGL the minimum number of attributes are supported.
</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=
"4" height=
"4" style=
"width: 40px; height: 30px;"></canvas>
18 <div id=
"description"></div>
19 <div id=
"console"></div>
20 <script id=
"vshader" type=
"x-shader/x-vertex">
21 attribute vec4 vPosition;
32 gl_Position = vPosition;
33 color = v0 + v1 + v2 + v3 + v4 + v5 + v6;
37 <script id=
"fshader" type=
"x-shader/x-fragment">
38 precision mediump float;
47 description(document
.title
);
48 var wtu
= WebGLTestUtils
;
49 var gl
= wtu
.create3DContext("example");
50 var program
= wtu
.setupTexturedQuad(gl
);
52 var program
= wtu
.setupProgram(
54 ['vshader', 'fshader'],
55 ['vPosition', 'v0', 'v1', 'v2', 'v3', 'v4', 'v5', 'v6'],
56 [0, 1, 2, 3, 4, 5, 6, 7]);
58 for (var ii
= 0; ii
< 7; ++ii
) {
59 var v
= (ii
+ 1) / 28;
60 var vertexObject
= gl
.createBuffer();
61 gl
.bindBuffer(gl
.ARRAY_BUFFER
, vertexObject
);
62 gl
.bufferData(gl
.ARRAY_BUFFER
, new Float32Array([
68 v
, v
/2, v/4, v
/8]), gl
.STATIC_DRAW
);
69 gl
.enableVertexAttribArray(ii
+ 1);
70 gl
.vertexAttribPointer(ii
+ 1, 4, gl
.FLOAT
, false, 0, 0);
73 wtu
.clearAndDrawUnitQuad(gl
);
74 wtu
.glErrorShouldBe(gl
, gl
.NO_ERROR
, "Should be no errors from setup.");
75 wtu
.checkCanvasRect(gl
, 0, 0, gl
.canvas
.width
, gl
.canvas
.height
, [255, 127, 64, 32], "Should render 255,127,64,32 (+/-1)", 1);
77 var successfullyParsed
= true;
81 <script src=
"../../js/js-test-post.js"></script>