test_read_pixels_no_format.html (644B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset=utf-8> 5 <script src='/tests/SimpleTest/SimpleTest.js'></script> 6 </head> 7 <body> 8 <pre id=e_out></pre> 9 <script> 10 ok = window.ok || function(e, s) { 11 e_out.textContent += `\n${!e ? 'FAIL' : 'pass'}: ${s}`; 12 }; 13 14 // - 15 16 const canvas = document.createElement('canvas') 17 document.documentElement.appendChild(canvas) 18 const gl = canvas.getContext('webgl2') 19 gl.bindBuffer(gl.PIXEL_PACK_BUFFER, gl.createBuffer()) 20 gl.readPixels(0, 0, 0, 0, gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT), 0, 0); 21 const err = gl.getError(); 22 ok(err == gl.INVALID_ENUM, `err: ${err}`); 23 24 ok(true, 'done'); 25 </script> 26 </body> 27 </html>