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

Side by Side Diff: conformance/limits/gl-min-attribs.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 the minimum number of attributes are supported.</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 <script src="../resources/webgl-test-utils.js"> </script>
15 </head>
16 <body>
17 <canvas id="example" width="4" height="4" style="width: 40px; height: 30px;"></c anvas>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script id="vshader" type="x-shader/x-vertex">
21 attribute vec4 vPosition;
22 attribute vec4 v0;
23 attribute vec4 v1;
24 attribute vec4 v2;
25 attribute vec4 v3;
26 attribute vec4 v4;
27 attribute vec4 v5;
28 attribute vec4 v6;
29 varying vec4 color;
30 void main()
31 {
32 gl_Position = vPosition;
33 color = v0 + v1 + v2 + v3 + v4 + v5 + v6;
34 }
35 </script>
36
37 <script id="fshader" type="x-shader/x-fragment">
38 precision mediump float;
39 varying vec4 color;
40 void main()
41 {
42 gl_FragColor = color;
43 }
44 </script>
45 <script>
46 var wtu = WebGLTestUtils;
47 var canvas = document.getElementById("example");
48 var gl = wtu.create3DContext(canvas);
49 var program = wtu.setupTexturedQuad(gl);
50
51 var program = wtu.setupProgram(
52 gl,
53 [wtu.loadShaderFromScript(gl, 'vshader', gl.VERTEX_SHADER),
54 wtu.loadShaderFromScript(gl, 'fshader', gl.FRAGMENT_SHADER)],
55 ['vPosition', 'v0', 'v1', 'v2', 'v3', 'v4', 'v5', 'v6'],
56 [0, 1, 2, 3, 4, 5, 6, 7]);
57
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([
63 v, v/2, v/4, v/8,
64 v, v/2, v/4, v/8,
65 v, v/2, v/4, v/8,
66 v, v/2, v/4, v/8,
67 v, v/2, v/4, v/8,
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);
71 }
72
73 wtu.drawQuad(gl);
74 glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
75 wtu.checkCanvasRect(gl, 0, 0, canvas.width, canvas.height, [255, 127, 64, 32], " Should render 255,127,64,32 (+/-1)", 1);
76
77 successfullyParsed = true;
78
79 </script>
80 </body>
81 <script src="../../resources/js-test-post.js"></script>
82
83 </body>
84 </html>
85
86
OLDNEW
« no previous file with comments | « conformance/limits/gl-max-texture-dimensions.html ('k') | conformance/limits/gl-min-textures.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698