tor-browser

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

texture-complete.html (1829B)


      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>WebGL "Texture Complete" texture conformance 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="40" height="40" style="width: 40px; height: 40px;"></canvas>
     18 <canvas id="canvas2d" width="16" height="16" style="width: 40px; height: 40px;"></canvas>
     19 <div id="description"></div>
     20 <div id="console"></div>
     21 <script>
     22 "use strict";
     23 function init()
     24 {
     25  description(
     26      "Checks that a texture that is not -texture-complete- does not draw if"+
     27      " filtering needs mips");
     28 
     29  var canvas2d = document.getElementById("canvas2d");
     30  var ctx2d = canvas2d.getContext("2d");
     31  ctx2d.fillStyle = "rgba(0,192,128,1)";
     32  ctx2d.fillRect(0, 0, 16, 16);
     33 
     34  var wtu = WebGLTestUtils;
     35  var canvas = document.getElementById("example");
     36  var gl = wtu.create3DContext(canvas);
     37  var program = wtu.setupTexturedQuad(gl);
     38 
     39  gl.disable(gl.DEPTH_TEST);
     40  gl.disable(gl.BLEND);
     41 
     42  var tex = gl.createTexture();
     43  gl.bindTexture(gl.TEXTURE_2D, tex);
     44  // 16x16 texture no mips
     45  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d);
     46 
     47  var loc = gl.getUniformLocation(program, "tex");
     48  gl.uniform1i(loc, 0);
     49 
     50  wtu.clearAndDrawUnitQuad(gl);
     51  wtu.checkCanvas(gl, [0,0,0,255],
     52      "texture that is not -texture-complete- when " +
     53      "TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with 0,0,0,255");
     54 }
     55 
     56 init();
     57 var successfullyParsed = true;
     58 </script>
     59 <script src="../../../js/js-test-post.js"></script>
     60 
     61 </body>
     62 </html>