content/canvas/test/webgl-conformance/conformance/textures/texture-complete.html

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

michael@0 1 <!--
michael@0 2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
michael@0 3 Use of this source code is governed by a BSD-style license that can be
michael@0 4 found in the LICENSE file.
michael@0 5 -->
michael@0 6 <!DOCTYPE html>
michael@0 7 <html>
michael@0 8 <head>
michael@0 9 <meta charset="utf-8">
michael@0 10 <title>WebGL "Texture Complete" texture conformance test.</title>
michael@0 11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
michael@0 12 <script src="../../resources/js-test-pre.js"></script>
michael@0 13 <script src="../resources/webgl-test.js"> </script>
michael@0 14 <script src="../resources/webgl-test-utils.js"></script>
michael@0 15 </head>
michael@0 16 <body>
michael@0 17 <canvas id="example" width="40" height="40" style="width: 40px; height: 40px;"></canvas>
michael@0 18 <canvas id="canvas2d" width="16" height="16" style="width: 40px; height: 40px;"></canvas>
michael@0 19 <div id="description"></div>
michael@0 20 <div id="console"></div>
michael@0 21 <script>
michael@0 22 function init()
michael@0 23 {
michael@0 24 if (window.initNonKhronosFramework) {
michael@0 25 window.initNonKhronosFramework(false);
michael@0 26 }
michael@0 27
michael@0 28 description(
michael@0 29 "Checks that a texture that is not -texture-complete- does not draw if"+
michael@0 30 " filtering needs mips");
michael@0 31
michael@0 32 var canvas2d = document.getElementById("canvas2d");
michael@0 33 var ctx2d = canvas2d.getContext("2d");
michael@0 34 ctx2d.fillStyle = "rgba(0,192,128,1)";
michael@0 35 ctx2d.fillRect(0, 0, 16, 16);
michael@0 36
michael@0 37 var wtu = WebGLTestUtils;
michael@0 38 var canvas = document.getElementById("example");
michael@0 39 gl = wtu.create3DContext(canvas);
michael@0 40 var program = wtu.setupTexturedQuad(gl);
michael@0 41
michael@0 42 gl.disable(gl.DEPTH_TEST);
michael@0 43 gl.disable(gl.BLEND);
michael@0 44
michael@0 45 var tex = gl.createTexture();
michael@0 46 gl.bindTexture(gl.TEXTURE_2D, tex);
michael@0 47 // 16x16 texture no mips
michael@0 48 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d);
michael@0 49
michael@0 50 var loc = gl.getUniformLocation(program, "tex");
michael@0 51 gl.uniform1i(loc, 0);
michael@0 52
michael@0 53 wtu.drawQuad(gl);
michael@0 54 wtu.checkCanvas(gl, [0,0,0,255],
michael@0 55 "texture that is not -texture-complete- when " +
michael@0 56 "TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with 0,0,0,255");
michael@0 57 }
michael@0 58
michael@0 59 init();
michael@0 60 successfullyParsed = true;
michael@0 61 </script>
michael@0 62
michael@0 63 <script>finishTest();</script>
michael@0 64
michael@0 65 </body>
michael@0 66 </html>
michael@0 67

mercurial