content/canvas/test/webgl-conformance/conformance/buffers/buffer-bind-test.html

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 <!--
     2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
     3 Use of this source code is governed by a BSD-style license that can be
     4 found in the LICENSE file.
     5  -->
     6 <!DOCTYPE html>
     7 <html>
     8   <head>
     9 <meta charset="utf-8">
    10     <title>WebGL BindBuffer conformance test.</title>
    11     <link rel="stylesheet" href="../../resources/js-test-style.css"/>
    12     <script src="../../resources/js-test-pre.js"></script>
    13     <script src="../resources/webgl-test.js"> </script>
    14 </head>
    15 <body>
    16 <canvas id="example" width="40" height="40" style="width: 40px; height: 40px;"></canvas>
    17 <div id="description"></div>
    18 <div id="console"></div>
    19 <script>
    20 description("Checks a buffer can only be bound to 1 target.");
    22 debug("");
    23 debug("Canvas.getContext");
    25 var gl = create3DContext(document.getElementById("canvas"));
    26 if (!gl) {
    27   testFailed("context does not exist");
    28 } else {
    29   testPassed("context exists");
    31   debug("");
    33   var buf = gl.createBuffer();
    34   gl.bindBuffer(gl.ARRAY_BUFFER, buf);
    35   glErrorShouldBe(gl, gl.NO_ERROR,
    36             "should be able to bind buffer.");
    37   gl.bindBuffer(gl.ARRAY_BUFFER, null);
    38   glErrorShouldBe(gl, gl.NO_ERROR,
    39             "should be able to unbind buffer.");
    40   gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buf);
    41   glErrorShouldBe(gl, gl.INVALID_OPERATION,
    42             "should get INVALID_OPERATION if attempting to bind buffer to different target");
    44   var buf = gl.createBuffer();
    45   gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buf);
    46   glErrorShouldBe(gl, gl.NO_ERROR,
    47             "should be able to bind buffer.");
    48   gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
    49   glErrorShouldBe(gl, gl.NO_ERROR,
    50             "should be able to unbind buffer.");
    51   gl.bindBuffer(gl.ARRAY_BUFFER, buf);
    52   glErrorShouldBe(gl, gl.INVALID_OPERATION,
    53             "should get INVALID_OPERATION if attempting to bind buffer to different target");
    54 }
    56 debug("");
    57 successfullyParsed = true;
    58 </script>
    59 <script>finishTest();</script>
    61 </body>
    62 </html>

mercurial