Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Side by Side Diff: conformance/attribs/gl-vertex-attrib.html

Issue 8342021: Add webgl conformance tests r15841. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!--
2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
5 -->
6 <!DOCTYPE html>
7 <html>
8 <head>
9 <meta charset="utf-8">
10 <title>WebGL vertexAttrib Conformance Tests</title>
11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
12 <script src="../../resources/js-test-pre.js"></script>
13 <script src="../resources/webgl-test.js"></script>
14 </head>
15 <body>
16 <div id="description"></div>
17 <div id="console"></div>
18 <canvas id="canvas" width="2" height="2"> </canvas>
19 <script>
20 description("This test ensures WebGL implementations vertexAttrib can be set and read.");
21
22 debug("");
23 debug("Canvas.getContext");
24
25 var gl = create3DContext(document.getElementById("canvas"));
26 if (!gl) {
27 testFailed("context does not exist");
28 } else {
29 testPassed("context exists");
30
31 debug("");
32 debug("Checking gl.vertexAttrib.");
33
34 var numVertexAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);
35 for (var ii = 0; ii < numVertexAttribs; ++ii) {
36 gl.vertexAttrib1fv(ii, [1]);
37 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '1') ;
38 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '0') ;
39 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '0') ;
40 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '1') ;
41
42 gl.vertexAttrib2fv(ii, [1, 2]);
43 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '1') ;
44 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '2') ;
45 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '0') ;
46 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '1') ;
47
48 gl.vertexAttrib3fv(ii, [1, 2, 3]);
49 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '1') ;
50 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '2') ;
51 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '3') ;
52 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '1') ;
53
54 gl.vertexAttrib4fv(ii, [1, 2, 3, 4]);
55 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '1') ;
56 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '2') ;
57 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '3') ;
58 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '4') ;
59
60 gl.vertexAttrib1f(ii, 5);
61 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '5') ;
62 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '0') ;
63 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '0') ;
64 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '1') ;
65
66 gl.vertexAttrib2f(ii, 6, 7);
67 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '6') ;
68 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '7') ;
69 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '0') ;
70 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '1') ;
71
72 gl.vertexAttrib3f(ii, 7, 8, 9);
73 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '7') ;
74 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '8') ;
75 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '9') ;
76 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '1') ;
77
78 gl.vertexAttrib4f(ii, 6, 7, 8, 9);
79 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '6') ;
80 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '7') ;
81 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '8') ;
82 shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '9') ;
83 }
84 glErrorShouldBe(gl, gl.NO_ERROR);
85 }
86
87 debug("");
88 successfullyParsed = true;
89
90 </script>
91 <script src="../../resources/js-test-post.js"></script>
92
93 </body>
94 </html>
OLDNEW
« no previous file with comments | « conformance/attribs/gl-enable-vertex-attrib.html ('k') | conformance/attribs/gl-vertex-attrib-zero-issues.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698