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

Side by Side Diff: third_party/webgl/conformance-suites/1.0.0/conformance/gl-vertex-attrib-zero-issues.html

Issue 9360034: Remove everthing except conformance tests in the deps/third_party/webgl (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 8 years, 10 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
OLDNEW
(Empty)
1 <!--
2 // Copyright (c) 2010 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 <title>WebGL Enable Vertex Attrib Zero Test</title>
10 <link rel="stylesheet" href="../resources/js-test-style.css"/>
11 <script src="../resources/js-test-pre.js"></script>
12 <script src="resources/webgl-test.js"> </script>
13 <script src="resources/webgl-test-utils.js"> </script>
14 </head>
15 <body>
16 <canvas id="example" width="50" height="50">
17 </canvas>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script id="vshader" type="x-shader/x-vertex">
21 attribute vec4 vPosition;
22 void main()
23 {
24 gl_Position = vPosition;
25 }
26 </script>
27
28 <script id="fshader" type="x-shader/x-fragment">
29 void main()
30 {
31 gl_FragColor = vec4(0.0,0.0,0.0,0.0);
32 }
33 </script>
34
35 <script>
36 description("Test some of the issues of the difference between attrib 0 on OpenG L vs WebGL");
37 debug("");
38 var wtu = WebGLTestUtils;
39 var canvas = document.getElementById("example");
40 var gl = wtu.create3DContext(canvas);
41
42 function setup(numVerts, attribIndex) {
43 var program = wtu.setupProgram(
44 gl,
45 [wtu.loadShaderFromScript(gl, 'vshader', gl.VERTEX_SHADER),
46 wtu.loadShaderFromScript(gl, 'fshader', gl.FRAGMENT_SHADER)],
47 ['vPosition'], [attribIndex]);
48 // draw with something on attrib zero with a small number of vertices
49 var vertexObject = gl.createBuffer();
50 g_program = program;
51 g_attribLocation = attribIndex;
52 shouldBe("g_attribLocation", "gl.getAttribLocation(g_program, 'vPosition')");
53 gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
54 gl.bufferData(
55 gl.ARRAY_BUFFER, new Float32Array(numVerts * 3), gl.STATIC_DRAW);
56 gl.vertexAttribPointer(attribIndex, 3, gl.FLOAT, false, 0, 0);
57 var indices = new Uint16Array(numVerts);
58 for (var ii = 0; ii < numVerts; ++ii) {
59 indices[ii] = ii;
60 }
61 var indexBuffer = gl.createBuffer();
62 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);
63 gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW);
64 return program;
65 }
66
67 var p1 = setup(3, 0);
68 var p2 = setup(60000, 3);
69
70 for (var ii = 0; ii < 5; ++ii) {
71 gl.useProgram(p1);
72 gl.enableVertexAttribArray(0);
73 gl.drawElements(gl.TRIANGLES, 3, gl.UNSIGNED_SHORT, 0);
74 glErrorShouldBe(
75 gl, gl.NO_ERROR,
76 "drawing using attrib 0 with 3 verts");
77
78 gl.useProgram(p2);
79 gl.enableVertexAttribArray(3);
80 gl.drawArrays(gl.LINES, 0, 60000);
81 glErrorShouldBe(
82 gl, gl.NO_ERROR,
83 "drawing using attrib 3 with 60000 verts");
84 }
85
86 wtu.checkCanvas(gl, [0, 0, 0, 0], "canvas should be 0, 0, 0, 0");
87
88 successfullyParsed = true;
89 </script>
90 <script src="../resources/js-test-post.js"></script>
91
92 <script>
93 </script>
94
95 </body>
96 </html>
97
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698