summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/compositing/webgl/webgl-no-alpha.html
blob: 1df59c28e56aa51f775bb3ca6511d37452a64ea3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html>
  <head>
    <style type="text/css" media="screen">
      body {
        outline: 10px solid transparent; /* affects layer sizes */
      }
      canvas {
        margin: 20px;
        width: 200px;
        height: 200px;
        padding: 0 20px;
      }
    
      .compare {
        margin-left: 40px;
        margin-top: 20px;
        width: 200px;
        height: 200px;
        background-color: rgba(0, 255, 0, 1.0);
      }
    </style>
    <script>
        if (window.testRunner) {
            testRunner.overridePreference("WebKitWebGLEnabled", "1");
            testRunner.dumpAsTextWithPixelResults();
        }

        function initWebGL(canvasName, vshader, fshader, attribs, clearColor, clearDepth)
        {
            var canvas = document.getElementById(canvasName);
            var gl = canvas.getContext("webgl", {alpha: false});
            if (!gl) {
                alert("No WebGL context found");
                return null;
            }

            gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
            gl.clearDepth(clearDepth);

            return gl;
        }

        function drawCanvas(canvasID)
        {
          var gl = initWebGL(canvasID, "", "", [], [ 0, 1, 0, 0 ], 1);
          gl.viewport(0, 0, 200, 200);
          gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
        }

        function init()
        {
          drawCanvas('canvas');
        }
    </script>
  </head>
  <body onload="init()">
   
    <div class="compare"></div>
    <canvas id="canvas" width="200" height="200"></canvas>

    <!-- Top and bottom should look the same. -->
  </body>
</html>