tor-browser

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

texImage2D.html (2084B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <!--
      6 Copyright (c) 2019 The Khronos Group Inc.
      7 Use of this source code is governed by an MIT-style license that can be
      8 found in the LICENSE.txt file.
      9 -->
     10 <link rel="stylesheet" type="text/css" href="../unit.css" />
     11 <script type="application/javascript" src="../unit.js"></script>
     12 <script type="application/javascript" src="../util.js"></script>
     13 <script type="application/javascript">
     14 
     15 Tests.startUnit = function () {
     16  var canvas = document.getElementById('gl');
     17  var gl = wrapGLContext(getGLContext(canvas));
     18  return [gl];
     19 }
     20 
     21 Tests.setup = function(gl) {
     22  var tex = gl.createTexture();
     23  gl.bindTexture(gl.TEXTURE_2D, tex);
     24  var texCubeMap = gl.createTexture();
     25  gl.bindTexture(gl.TEXTURE_CUBE_MAP, texCubeMap);
     26  return [gl]
     27 }
     28 
     29 Tests.teardown = function(gl,tex,texCubeMap) {
     30  gl.bindTexture(gl.TEXTURE_2D, null);
     31  gl.bindTexture(gl.TEXTURE_CUBE_MAP, null);
     32  gl.deleteTexture(tex);
     33  gl.deleteTexture(texCubeMap);
     34 }
     35 
     36 Tests.testTexImage2D = function(gl) {
     37  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([0,0,0,0]));
     38  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2,1,0,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([0,0,0,0,0,0,0,0]));
     39  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,2,0,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([0,0,0,0,0,0,0,0]));
     40  var valid_targets = [
     41    gl.TEXTURE_2D,
     42    gl.TEXTURE_CUBE_MAP_POSITIVE_X,
     43    gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
     44    gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
     45    gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
     46    gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
     47    gl.TEXTURE_CUBE_MAP_NEGATIVE_Z
     48  ];
     49  valid_targets.forEach(function(t) {
     50    assertOk(function(){gl.texImage2D(t, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([0,0,0,0]));});
     51  });
     52 }
     53 
     54 Tests.testTexImage2DNull = function(gl) {
     55  assertOk(function(){gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.UNSIGNED_BYTE, null);});
     56 }
     57 
     58 Tests.endUnit = function(gl) {
     59 }
     60 
     61 </script>
     62 <style>canvas{ position:absolute; }</style>
     63 </head><body>
     64 <canvas id="gl" width="16" height="16"></canvas>
     65 </body></html>