tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

simple.html (1871B)


      1 <!--
      2 Copyright (c) 2019 The Khronos Group Inc.
      3 Use of this source code is governed by an MIT-style license that can be
      4 found in the LICENSE.txt file.
      5 -->
      6 
      7 <!DOCTYPE html>
      8 <html>
      9 <head>
     10 <meta charset="utf-8">
     11 <title>Simple Rendering Test</title>
     12 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
     13 <script src="../../js/js-test-pre.js"></script>
     14 <script src="../../js/webgl-test-utils.js"> </script>
     15 </head>
     16 <body>
     17 <canvas id="example" width="50" height="50">
     18 There is supposed to be an example drawing here, but it's not important.
     19 </canvas>
     20 <div id="description"></div>
     21 <div id="console"></div>
     22 <script id="vshader" type="x-shader/x-vertex">
     23 attribute vec4 a_Position;
     24 void main()
     25 {
     26  gl_Position = a_Position;
     27 }
     28 </script>
     29 
     30 <script id="fshader" type="x-shader/x-fragment">
     31 void main()
     32 {
     33  gl_FragColor = vec4(0,1,0,1);
     34 }
     35 </script>
     36 <script>
     37 "use strict";
     38 var wtu = WebGLTestUtils;
     39 function init()
     40 {
     41  description();
     42 
     43  var gl = wtu.create3DContext("example");
     44  var program = wtu.loadProgramFromScript(gl, "vshader", "fshader");
     45  gl.useProgram(program);
     46  var loc = gl.getAttribLocation(program, "a_Position");
     47 
     48  var vertexObject = gl.createBuffer();
     49  gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
     50  gl.bufferData(
     51    gl.ARRAY_BUFFER,
     52    new Float32Array(
     53    [  1,  1,
     54      -1,  1,
     55      -1, -1,
     56       1,  1,
     57      -1, -1,
     58       1, -1]),
     59    gl.STATIC_DRAW);
     60  gl.enableVertexAttribArray(loc);
     61  gl.vertexAttribPointer(loc, 2, gl.FLOAT, false, 0, 0);
     62 
     63  gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
     64  wtu.checkCanvas(gl, [0,0,0,0], "should be black", 0);
     65  gl.drawArrays(gl.TRIANGLES, 0, 6);
     66  wtu.checkCanvas(gl, [0,255,0,255], "should be green", 0);
     67 
     68  wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors");
     69 }
     70 
     71 init();
     72 var successfullyParsed = true;
     73 </script>
     74 <script src="../../js/js-test-post.js"></script>
     75 
     76 </body>
     77 </html>