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

Side by Side Diff: conformance/glsl/variables/gl-frontfacing.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:executable
+ *
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>gl-fragcoord Test</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="32" height="32">
18 </canvas>
19 <div id="description"></div>
20 <div id="console"></div>
21 <script id="vshader" type="x-shader/x-vertex">
22 attribute vec4 vPosition;
23 void main()
24 {
25 gl_Position = vPosition;
26 }
27 </script>
28
29 <script id="fshader" type="x-shader/x-fragment">
30 precision mediump float;
31 void main()
32 {
33 gl_FragColor = vec4(
34 gl_FrontFacing ? 1.0 : 0.0,
35 gl_FrontFacing ? 0.0 : 1.0,
36 0,
37 1);
38 }
39 </script>
40
41 <script>
42 function init()
43 {
44 if (window.initNonKhronosFramework) {
45 window.initNonKhronosFramework(false);
46 }
47
48 wtu = WebGLTestUtils;
49 gl = initWebGL("example", "vshader", "fshader", [ "vPosition"], [ 0, 0, 0, 1 ], 1);
50
51 var gridRes = 4;
52 wtu.setupQuad(gl, gridRes, 0, true);
53
54 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
55 gl.drawElements(gl.TRIANGLES, gridRes * gridRes * 6, gl.UNSIGNED_SHORT, 0) ;
56 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "no errors from draw");
57
58 var step = 32 / gridRes;
59 var halfStep = step / 2;
60 var quarterStep = halfStep / 2;
61 for (var xx = 0; xx < 32; xx += step) {
62 for (var yy = 0; yy < 32; yy += step) {
63 for (var ii = 0; ii < 2; ++ii) {
64 var color = [
65 ii == 0 ? 255 : 0,
66 ii == 0 ? 0 : 255,
67 0
68 ];
69 var msg = "should be " + color;
70 wtu.checkCanvasRect(
71 gl,
72 xx + quarterStep + halfStep * ii,
73 yy + quarterStep + halfStep * ii,
74 1, 1, color, msg, 4);
75 }
76 }
77 }
78 }
79
80 init();
81 successfullyParsed = true;
82 </script>
83 <script src="../../../resources/js-test-post.js"></script>
84
85 </body>
86 </html>
OLDNEW
« no previous file with comments | « conformance/glsl/variables/gl-fragcoord.html ('k') | conformance/glsl/variables/gl-pointcoord.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698