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

Side by Side Diff: third_party/webgl/conformance-suites/1.0.0/extra/lots-of-polys-example.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) 2009 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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
7 "http://www.w3.org/TR/html4/loose.dtd">
8 <html>
9 <head>
10 <title>WebGL Lots of polygons example.</title>
11 <link rel="stylesheet" href="../resources/js-test-style.css"/>
12 <script src="../resources/js-test-pre.js"></script>
13 <script src="../conformance/resources/webgl-test-utils.js"> </script>
14 </head>
15 <body>
16 <canvas id="example" width="1024" height="1024" style="width: 40px; height: 40px ;">
17 </canvas>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script>
21 window.onload = init;
22 debug("Tests a WebGL program that draws a bunch of large polygons");
23
24 function init() {
25 if (confirm(
26 "after clicking ok your machine may be come unresponsive or crash")) {
27 main();
28 } else {
29 debug("cancelled");
30 }
31 }
32
33 function main() {
34 var wtu = WebGLTestUtils;
35 var canvas = document.getElementById("example");
36 var gl = wtu.create3DContext(canvas);
37 var program = wtu.setupTexturedQuad(gl);
38
39 assertMsg(gl.getError() == gl.NO_ERROR, "Should be no errors from setup.");
40
41 var tex = gl.createTexture();
42 gl.enable(gl.BLEND);
43 gl.disable(gl.DEPTH_TEST);
44
45 wtu.fillTexture(gl, tex, 4096, 4096, [0, 192, 128, 255], 0);
46 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after creating texture");
47
48 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
49 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
50 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
51 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
52 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after setting texture params");
53
54 var loc = gl.getUniformLocation(program, "tex");
55 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after getting tex locations");
56 gl.uniform1i(loc, 0);
57 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after setting tex uniform");
58
59 var numQuads = 100000;
60 var indexBuf = new ArrayBuffer(numQuads * 6);
61 var indices = new Uint8Array(indexBuf);
62 for (var ii = 0; ii < numQuads; ++ii) {
63 var offset = ii * 6;
64 indices[offset + 0] = 0;
65 indices[offset + 1] = 1;
66 indices[offset + 2] = 2;
67 indices[offset + 3] = 3;
68 indices[offset + 4] = 4;
69 indices[offset + 5] = 5;
70 }
71 var indexBuffer = gl.createBuffer();
72 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);
73 gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW);
74 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after creating index buffer");
75 gl.drawElements(gl.TRIANGLES, numQuads * 6, gl.UNSIGNED_BYTE, 0);
76 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after drawing");
77
78 successfullyParsed = true;
79 }
80 </script>
81 </body>
82 </html>
83
84
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698