2 <html class=
"reftest-wait">
4 <script type=
"text/javascript">
8 var canvas
= document
.getElementById("glcanvas");
9 gl
= canvas
.getContext("webgl") || canvas
.getContext("experimental-webgl");
18 function initTextures() {
19 var cubeTexture
= gl
.createTexture();
20 var cubeImage
= document
.getElementById("i");
21 cubeImage
.onload = function() { handleTextureLoaded(cubeImage
, cubeTexture
); }
22 cubeImage
.onerror = function() { finish(); }
23 cubeImage
.src
= "1251091-1.png";
26 function handleTextureLoaded(image
, texture
) {
27 gl
.bindTexture(gl
.TEXTURE_2D
, texture
);
28 gl
.texImage2D(gl
.TEXTURE_2D
, 0, gl
.RGBA
, gl
.RGBA
, gl
.UNSIGNED_BYTE
, image
);
29 gl
.texParameteri(gl
.TEXTURE_2D
, gl
.TEXTURE_MAG_FILTER
, gl
.LINEAR
);
30 gl
.texParameteri(gl
.TEXTURE_2D
, gl
.TEXTURE_MIN_FILTER
, gl
.LINEAR_MIPMAP_NEAREST
);
31 gl
.generateMipmap(gl
.TEXTURE_2D
);
32 gl
.bindTexture(gl
.TEXTURE_2D
, null);
37 document
.getElementById("i").style
.display
= "";
42 document
.documentElement
.removeAttribute("class");
47 <body onload=
"start()">
48 <canvas id=
"glcanvas" width=
"640" height=
"480"></canvas>
49 <img id=
"i" style=
"display: none;">