1355898-1.html (1139B)
1 <!doctype html> 2 <html> 3 <head> 4 <script> 5 // Test that texImage2D on an animated image doesn't assert. 6 7 var gl; 8 9 function start() { 10 canvas = document.getElementById("glcanvas"); 11 gl = null; 12 13 try { 14 gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); 15 } 16 catch(e) { 17 } 18 19 if (!gl) { 20 return; 21 } 22 23 var texture = gl.createTexture(); 24 var image = new Image(); 25 image.onload = function() { handleTextureLoaded(image, texture); } 26 image.src = "1249576-1.png"; // an animated png 27 } 28 29 function handleTextureLoaded(image, texture) { 30 gl.bindTexture(gl.TEXTURE_2D, texture); 31 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); 32 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); 33 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); 34 gl.generateMipmap(gl.TEXTURE_2D); 35 gl.bindTexture(gl.TEXTURE_2D, null); 36 } 37 </script> 38 </head> 39 40 <body onload="start()"> 41 <canvas id="glcanvas" width="640" height="480"> 42 Your browser doesn't appear to support the <code><canvas></code> element. 43 </canvas> 44 </body> 45 </html>