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.
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">
15 Tests.startUnit = function () {
16 var canvas = document.getElementById('gl');
17 var gl = wrapGLContext(getGLContext(canvas));
21 Tests.testIs = function(gl) {
22 var tex = loadTexture(gl, document.getElementById('
2d'));
23 gl.bindTexture(gl.TEXTURE_2D, tex);
24 var fbo = new FBO(gl,
1,
1);
26 var prog = gl.createProgram();
27 var sh1 = gl.createShader(gl.VERTEX_SHADER);
28 var sh2 = gl.createShader(gl.FRAGMENT_SHADER);
29 var buf = gl.createBuffer();
30 gl.bindBuffer(gl.ARRAY_BUFFER, buf);
31 assert(
"tex", gl.isTexture(tex));
32 assert(
"fbo", gl.isFramebuffer(fbo.fbo));
33 assert(
"rbo", gl.isRenderbuffer(fbo.rbo));
34 assert(
"prog", gl.isProgram(prog));
35 assert(
"sh1", gl.isShader(sh1));
36 assert(
"sh2", gl.isShader(sh2));
37 assert(
"buf", gl.isBuffer(buf));
38 gl.deleteTexture(tex);
39 gl.deleteFramebuffer(fbo.fbo);
40 gl.deleteRenderbuffer(fbo.rbo);
41 gl.deleteProgram(prog);
45 // NOTE: we purposely do not unbind things.
46 assert(
"tex", !gl.isTexture(tex));
47 assert(
"fbo", !gl.isFramebuffer(fbo.fbo));
48 assert(
"rbo", !gl.isRenderbuffer(fbo.rbo));
49 assert(
"prog", !gl.isProgram(prog));
50 assert(
"sh1", !gl.isShader(sh1));
51 assert(
"sh2", !gl.isShader(sh2));
52 assert(
"buf", !gl.isBuffer(buf));
57 <style>canvas{ position:absolute; }
</style>
59 <canvas id=
"gl" width=
"1" height=
"1"></canvas>
60 <canvas id=
"2d" width=
"16" height=
"16"></canvas>