| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 5 <title>WebGL Uninitialized GL Resources Tests</title> | 5 <title>WebGL Uninitialized GL Resources Tests</title> |
| 6 <script src="../../../resources/js-test.js"></script> | 6 <script src="../../../resources/js-test.js"></script> |
| 7 <script src="resources/webgl-test.js"></script> | 7 <script src="resources/webgl-test.js"></script> |
| 8 </head> | 8 </head> |
| 9 <body> | 9 <body> |
| 10 <div id="description"></div> | 10 <div id="description"></div> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 gl.finish(); // make sure it has been uploaded | 37 gl.finish(); // make sure it has been uploaded |
| 38 | 38 |
| 39 gl.deleteTexture(texture); | 39 gl.deleteTexture(texture); |
| 40 gl.finish(); // make sure it has been deleted | 40 gl.finish(); // make sure it has been deleted |
| 41 | 41 |
| 42 var texture = gl.createTexture(); | 42 var texture = gl.createTexture(); |
| 43 gl.bindTexture(gl.TEXTURE_2D, texture); | 43 gl.bindTexture(gl.TEXTURE_2D, texture); |
| 44 return texture; | 44 return texture; |
| 45 } | 45 } |
| 46 | 46 |
| 47 function checkNonZeroPixels(texture, texWidth, texHeight, skipX, skipY, skipWidt
h, skipHeight, skipR, skipG, skipB, skipA) { | 47 function checkPixels(texture, texWidth, texHeight, skipX, skipY, skipWidth, skip
Height, skipR, skipG, skipB, skipA, expectedValue) { |
| 48 gl.bindTexture(gl.TEXTURE_2D, null); | 48 gl.bindTexture(gl.TEXTURE_2D, null); |
| 49 var fb = gl.createFramebuffer(); | 49 var fb = gl.createFramebuffer(); |
| 50 gl.bindFramebuffer(gl.FRAMEBUFFER, fb); | 50 gl.bindFramebuffer(gl.FRAMEBUFFER, fb); |
| 51 gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D,
texture, 0); | 51 gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D,
texture, 0); |
| 52 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLE
TE"); | 52 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLE
TE"); |
| 53 | 53 |
| 54 var data = new Uint8Array(texWidth * texHeight * 4); | 54 var data = new Uint8Array(texWidth * texHeight * 4); |
| 55 gl.readPixels(0, 0, texWidth, texHeight, gl.RGBA, gl.UNSIGNED_BYTE, data); | 55 gl.readPixels(0, 0, texWidth, texHeight, gl.RGBA, gl.UNSIGNED_BYTE, data); |
| 56 | 56 |
| 57 var k = 0; | 57 var k = 0; |
| 58 for (var y = 0; y < texHeight; ++y) { | 58 for (var y = 0; y < texHeight; ++y) { |
| 59 for (var x = 0; x < texWidth; ++x) { | 59 for (var x = 0; x < texWidth; ++x) { |
| 60 var index = (y * texWidth + x) * 4; | 60 var index = (y * texWidth + x) * 4; |
| 61 if (x >= skipX && x < skipX + skipWidth && y >= skipY && y < skipY +
skipHeight) { | 61 if (x >= skipX && x < skipX + skipWidth && y >= skipY && y < skipY +
skipHeight) { |
| 62 if (data[index] != skipR || data[index + 1] != skipG || data[ind
ex + 2] != skipB || data[index + 3] != skipA) { | 62 if (data[index] != skipR || data[index + 1] != skipG || data[ind
ex + 2] != skipB || data[index + 3] != skipA) { |
| 63 testFailed("non-zero pixel values are wrong"); | 63 testFailed("non-zero pixel values are wrong"); |
| 64 return; | 64 return; |
| 65 } | 65 } |
| 66 } else { | 66 } else { |
| 67 for (var i = 0; i < 4; ++i) { | 67 for (var i = 0; i < 4; ++i) { |
| 68 if (data[index + i] != 0) | 68 if (data[index + i] != expectedValue) |
| 69 k++; | 69 k++; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 if (k) { | 74 if (k) { |
| 75 testFailed("Found " + k + " non-zero bytes"); | 75 testFailed("Found " + k + " unexpected bytes"); |
| 76 } else { | 76 } else { |
| 77 testPassed("All data initialized"); | 77 testPassed("All data is expected"); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 var width = 512; | 81 var width = 512; |
| 82 var height = 512; | 82 var height = 512; |
| 83 | 83 |
| 84 debug(""); | 84 debug(""); |
| 85 debug("Reading an uninitialized texture (texImage2D) should succeed with all byt
es set to 0."); | 85 debug("Reading an uninitialized texture (texImage2D) should succeed with all byt
es set to 0."); |
| 86 | 86 |
| 87 var tex = setupTexture(width, height); | 87 var tex = setupTexture(width, height); |
| 88 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_
BYTE, null); | 88 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_
BYTE, null); |
| 89 checkNonZeroPixels(tex, width, height, 0, 0, 0, 0, 0, 0, 0, 0); | 89 checkPixels(tex, width, height, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
| 90 gl.deleteTexture(tex); | 90 gl.deleteTexture(tex); |
| 91 gl.finish(); | 91 gl.finish(); |
| 92 glErrorShouldBe(gl, gl.NO_ERROR); | 92 glErrorShouldBe(gl, gl.NO_ERROR); |
| 93 | 93 |
| 94 debug(""); | 94 debug(""); |
| 95 debug("Reading an uninitialized portion of a texture (copyTexImage2D) should suc
ceed with all bytes set to 0."); | 95 debug("Reading an uninitialized portion of a texture (copyTexImage2D) should suc
ceed with all bytes set to 0."); |
| 96 | 96 |
| 97 var tex = setupTexture(width, height); | 97 var tex = setupTexture(width, height); |
| 98 var fbo = gl.createFramebuffer(); | 98 var fbo = gl.createFramebuffer(); |
| 99 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); | 99 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); |
| 100 var rbo = gl.createRenderbuffer(); | 100 var rbo = gl.createRenderbuffer(); |
| 101 gl.bindRenderbuffer(gl.RENDERBUFFER, rbo); | 101 gl.bindRenderbuffer(gl.RENDERBUFFER, rbo); |
| 102 var fboWidth = 16; | 102 var fboWidth = 16; |
| 103 var fboHeight = 16; | 103 var fboHeight = 16; |
| 104 gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, fboWidth, fboHeight); | 104 gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, fboWidth, fboHeight); |
| 105 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER
, rbo); | 105 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER
, rbo); |
| 106 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE")
; | 106 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE")
; |
| 107 gl.clearColor(1.0, 0.0, 0.0, 1.0); | 107 gl.clearColor(1.0, 0.0, 0.0, 1.0); |
| 108 gl.clear(gl.COLOR_BUFFER_BIT); | 108 gl.clear(gl.COLOR_BUFFER_BIT); |
| 109 glErrorShouldBe(gl, gl.NO_ERROR); | 109 glErrorShouldBe(gl, gl.NO_ERROR); |
| 110 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, width, height, 0); | 110 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, width, height, 0); |
| 111 checkNonZeroPixels(tex, width, height, 0, 0, fboWidth, fboHeight, 255, 0, 0, 255
); | 111 checkPixels(tex, width, height, 0, 0, fboWidth, fboHeight, 255, 0, 0, 255, 0); |
| 112 gl.deleteTexture(tex); | 112 gl.deleteTexture(tex); |
| 113 gl.finish(); | 113 gl.finish(); |
| 114 glErrorShouldBe(gl, gl.NO_ERROR); | 114 glErrorShouldBe(gl, gl.NO_ERROR); |
| 115 | 115 |
| 116 debug(""); | 116 debug(""); |
| 117 debug("Reading an uninitialized portion of a texture (copyTexImage2D with negati
ve x and y) should succeed with all bytes set to 0."); | 117 debug("Reading an uninitialized portion of a texture (copyTexImage2D with negati
ve x and y) should succeed with all bytes set to 0."); |
| 118 | 118 |
| 119 var tex = setupTexture(width, height); | 119 var tex = setupTexture(width, height); |
| 120 var fbo = gl.createFramebuffer(); | 120 var fbo = gl.createFramebuffer(); |
| 121 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); | 121 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); |
| 122 var rbo = gl.createRenderbuffer(); | 122 var rbo = gl.createRenderbuffer(); |
| 123 gl.bindRenderbuffer(gl.RENDERBUFFER, rbo); | 123 gl.bindRenderbuffer(gl.RENDERBUFFER, rbo); |
| 124 var fboWidth = 16; | 124 var fboWidth = 16; |
| 125 var fboHeight = 16; | 125 var fboHeight = 16; |
| 126 gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, fboWidth, fboHeight); | 126 gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, fboWidth, fboHeight); |
| 127 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER
, rbo); | 127 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER
, rbo); |
| 128 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE")
; | 128 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE")
; |
| 129 gl.clearColor(1.0, 0.0, 0.0, 1.0); | 129 gl.clearColor(1.0, 0.0, 0.0, 1.0); |
| 130 gl.clear(gl.COLOR_BUFFER_BIT); | 130 gl.clear(gl.COLOR_BUFFER_BIT); |
| 131 glErrorShouldBe(gl, gl.NO_ERROR); | 131 glErrorShouldBe(gl, gl.NO_ERROR); |
| 132 var x = -8; | 132 var x = -8; |
| 133 var y = -8; | 133 var y = -8; |
| 134 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, x, y, width, height, 0); | 134 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, x, y, width, height, 0); |
| 135 checkNonZeroPixels(tex, width, height, -x, -y, fboWidth, fboHeight, 255, 0, 0, 2
55); | 135 checkPixels(tex, width, height, -x, -y, fboWidth, fboHeight, 255, 0, 0, 255, 0); |
| 136 gl.deleteTexture(tex); | 136 gl.deleteTexture(tex); |
| 137 gl.finish(); | 137 gl.finish(); |
| 138 glErrorShouldBe(gl, gl.NO_ERROR); | 138 glErrorShouldBe(gl, gl.NO_ERROR); |
| 139 | 139 |
| 140 debug(""); | 140 debug(""); |
| 141 debug("Reading an uninitialized portion of a texture (copyTexImage2D from WebGL
internal fbo) should succeed with all bytes set to 0."); | 141 debug("Reading an uninitialized portion of a texture (copyTexImage2D from WebGL
internal fbo) should succeed with all bytes set to 0."); |
| 142 | 142 |
| 143 var tex = setupTexture(width, height); | 143 var tex = setupTexture(width, height); |
| 144 gl.bindFramebuffer(gl.FRAMEBUFFER, null); | 144 gl.bindFramebuffer(gl.FRAMEBUFFER, null); |
| 145 gl.clearColor(0.0, 1.0, 0.0, 0.0); | 145 gl.clearColor(0.0, 1.0, 0.0, 0.0); |
| 146 gl.clear(gl.COLOR_BUFFER_BIT); | 146 gl.clear(gl.COLOR_BUFFER_BIT); |
| 147 glErrorShouldBe(gl, gl.NO_ERROR); | 147 glErrorShouldBe(gl, gl.NO_ERROR); |
| 148 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, width, height, 0); | 148 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, width, height, 0); |
| 149 checkNonZeroPixels(tex, width, height, 0, 0, canvas.width, canvas.height, 0, 255
, 0, 0); | 149 checkPixels(tex, width, height, 0, 0, canvas.width, canvas.height, 0, 255, 0, 0,
0); |
| 150 gl.deleteTexture(tex); | 150 gl.deleteTexture(tex); |
| 151 gl.finish(); | 151 gl.finish(); |
| 152 glErrorShouldBe(gl, gl.NO_ERROR); | 152 glErrorShouldBe(gl, gl.NO_ERROR); |
| 153 | 153 |
| 154 debug(""); | 154 debug(""); |
| 155 debug("Reading an uninitialized portion of a texture (copyTexSubImage2D) should
succeed with all bytes set to 0."); | 155 debug("Reading an uninitialized portion of a texture (copyTexSubImage2D) should
succeed with all bytes untouched."); |
| 156 | 156 |
| 157 var tex = gl.createTexture(); | 157 var tex = gl.createTexture(); |
| 158 gl.bindTexture(gl.TEXTURE_2D, tex); | 158 gl.bindTexture(gl.TEXTURE_2D, tex); |
| 159 var data = new Uint8Array(width * height * 4); | 159 var data = new Uint8Array(width * height * 4); |
| 160 for (var i = 0; i < width * height * 4; ++i) | 160 for (var i = 0; i < width * height * 4; ++i) |
| 161 data[i] = 255; | 161 data[i] = 255; |
| 162 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_
BYTE, data); | 162 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_
BYTE, data); |
| 163 glErrorShouldBe(gl, gl.NO_ERROR); | 163 glErrorShouldBe(gl, gl.NO_ERROR); |
| 164 var fbo = gl.createFramebuffer(); | 164 var fbo = gl.createFramebuffer(); |
| 165 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); | 165 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); |
| 166 var rbo = gl.createRenderbuffer(); | 166 var rbo = gl.createRenderbuffer(); |
| 167 gl.bindRenderbuffer(gl.RENDERBUFFER, rbo); | 167 gl.bindRenderbuffer(gl.RENDERBUFFER, rbo); |
| 168 var fboWidth = 16; | 168 var fboWidth = 16; |
| 169 var fboHeight = 16; | 169 var fboHeight = 16; |
| 170 gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, fboWidth, fboHeight); | 170 gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, fboWidth, fboHeight); |
| 171 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER
, rbo); | 171 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER
, rbo); |
| 172 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE")
; | 172 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE")
; |
| 173 gl.clearColor(1.0, 0.0, 0.0, 1.0); | 173 gl.clearColor(1.0, 0.0, 0.0, 1.0); |
| 174 gl.clear(gl.COLOR_BUFFER_BIT); | 174 gl.clear(gl.COLOR_BUFFER_BIT); |
| 175 glErrorShouldBe(gl, gl.NO_ERROR); | 175 glErrorShouldBe(gl, gl.NO_ERROR); |
| 176 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, width, height); | 176 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, width, height); |
| 177 checkNonZeroPixels(tex, width, height, 0, 0, fboWidth, fboHeight, 255, 0, 0, 255
); | 177 checkPixels(tex, width, height, 0, 0, fboWidth, fboHeight, 255, 0, 0, 255, 255); |
| 178 gl.deleteTexture(tex); | 178 gl.deleteTexture(tex); |
| 179 gl.finish(); | 179 gl.finish(); |
| 180 glErrorShouldBe(gl, gl.NO_ERROR); | 180 glErrorShouldBe(gl, gl.NO_ERROR); |
| 181 | 181 |
| 182 debug(""); | 182 debug(""); |
| 183 debug("Reading an uninitialized portion of a texture (copyTexSubImage2D with neg
ative x and y) should succeed with all bytes set to 0."); | 183 debug("Reading an uninitialized portion of a texture (copyTexSubImage2D with neg
ative x and y) should succeed with all bytes untouched."); |
| 184 | 184 |
| 185 var tex = gl.createTexture(); | 185 var tex = gl.createTexture(); |
| 186 gl.bindTexture(gl.TEXTURE_2D, tex); | 186 gl.bindTexture(gl.TEXTURE_2D, tex); |
| 187 var data = new Uint8Array(width * height * 4); | 187 var data = new Uint8Array(width * height * 4); |
| 188 for (var i = 0; i < width * height * 4; ++i) | 188 for (var i = 0; i < width * height * 4; ++i) |
| 189 data[i] = 255; | 189 data[i] = 255; |
| 190 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_
BYTE, data); | 190 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_
BYTE, data); |
| 191 glErrorShouldBe(gl, gl.NO_ERROR); | 191 glErrorShouldBe(gl, gl.NO_ERROR); |
| 192 var fbo = gl.createFramebuffer(); | 192 var fbo = gl.createFramebuffer(); |
| 193 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); | 193 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); |
| 194 var rbo = gl.createRenderbuffer(); | 194 var rbo = gl.createRenderbuffer(); |
| 195 gl.bindRenderbuffer(gl.RENDERBUFFER, rbo); | 195 gl.bindRenderbuffer(gl.RENDERBUFFER, rbo); |
| 196 var fboWidth = 16; | 196 var fboWidth = 16; |
| 197 var fboHeight = 16; | 197 var fboHeight = 16; |
| 198 gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, fboWidth, fboHeight); | 198 gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, fboWidth, fboHeight); |
| 199 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER
, rbo); | 199 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER
, rbo); |
| 200 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE")
; | 200 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE")
; |
| 201 gl.clearColor(1.0, 0.0, 0.0, 1.0); | 201 gl.clearColor(1.0, 0.0, 0.0, 1.0); |
| 202 gl.clear(gl.COLOR_BUFFER_BIT); | 202 gl.clear(gl.COLOR_BUFFER_BIT); |
| 203 glErrorShouldBe(gl, gl.NO_ERROR); | 203 glErrorShouldBe(gl, gl.NO_ERROR); |
| 204 var x = -8; | 204 var x = -8; |
| 205 var y = -8; | 205 var y = -8; |
| 206 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, x, y, width, height); | 206 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, x, y, width, height); |
| 207 checkNonZeroPixels(tex, width, height, -x, -y, fboWidth, fboHeight, 255, 0, 0, 2
55); | 207 checkPixels(tex, width, height, -x, -y, fboWidth, fboHeight, 255, 0, 0, 255, 255
); |
| 208 gl.deleteTexture(tex); | 208 gl.deleteTexture(tex); |
| 209 gl.finish(); | 209 gl.finish(); |
| 210 glErrorShouldBe(gl, gl.NO_ERROR); | 210 glErrorShouldBe(gl, gl.NO_ERROR); |
| 211 | 211 |
| 212 debug(""); | 212 debug(""); |
| 213 debug("Reading an uninitialized portion of a texture (copyTexSubImage2D from Web
GL internal fbo) should succeed with all bytes set to 0."); | 213 debug("Reading an uninitialized portion of a texture (copyTexSubImage2D from Web
GL internal fbo) should succeed with all bytes untouched."); |
| 214 | 214 |
| 215 var tex = gl.createTexture(); | 215 var tex = gl.createTexture(); |
| 216 gl.bindTexture(gl.TEXTURE_2D, tex); | 216 gl.bindTexture(gl.TEXTURE_2D, tex); |
| 217 var data = new Uint8Array(width * height * 4); | 217 var data = new Uint8Array(width * height * 4); |
| 218 for (var i = 0; i < width * height * 4; ++i) | 218 for (var i = 0; i < width * height * 4; ++i) |
| 219 data[i] = 255; | 219 data[i] = 255; |
| 220 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_
BYTE, data); | 220 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_
BYTE, data); |
| 221 glErrorShouldBe(gl, gl.NO_ERROR); | 221 glErrorShouldBe(gl, gl.NO_ERROR); |
| 222 gl.bindFramebuffer(gl.FRAMEBUFFER, null); | 222 gl.bindFramebuffer(gl.FRAMEBUFFER, null); |
| 223 gl.clearColor(0.0, 1.0, 0.0, 0.0); | 223 gl.clearColor(0.0, 1.0, 0.0, 0.0); |
| 224 gl.clear(gl.COLOR_BUFFER_BIT); | 224 gl.clear(gl.COLOR_BUFFER_BIT); |
| 225 glErrorShouldBe(gl, gl.NO_ERROR); | 225 glErrorShouldBe(gl, gl.NO_ERROR); |
| 226 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, width, height); | 226 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, width, height); |
| 227 checkNonZeroPixels(tex, width, height, 0, 0, canvas.width, canvas.height, 0, 255
, 0, 0); | 227 checkPixels(tex, width, height, 0, 0, canvas.width, canvas.height, 0, 255, 0, 0,
255); |
| 228 gl.deleteTexture(tex); | 228 gl.deleteTexture(tex); |
| 229 gl.finish(); | 229 gl.finish(); |
| 230 glErrorShouldBe(gl, gl.NO_ERROR); | 230 glErrorShouldBe(gl, gl.NO_ERROR); |
| 231 | 231 |
| 232 //TODO: uninitialized vertex array buffer | 232 //TODO: uninitialized vertex array buffer |
| 233 //TODO: uninitialized vertex elements buffer | 233 //TODO: uninitialized vertex elements buffer |
| 234 //TODO: uninitialized framebuffer? (implementations would need to do a GL clear
at first binding?) | 234 //TODO: uninitialized framebuffer? (implementations would need to do a GL clear
at first binding?) |
| 235 //TODO: uninitialized renderbuffer? (implementations would need to do a GL clear
at first binding?) | 235 //TODO: uninitialized renderbuffer? (implementations would need to do a GL clear
at first binding?) |
| 236 //TODO: uninitialized uniform arrays? | 236 //TODO: uninitialized uniform arrays? |
| 237 | 237 |
| 238 debug(""); | 238 debug(""); |
| 239 </script> | 239 </script> |
| 240 </body> | 240 </body> |
| 241 </html> | 241 </html> |
| 242 | 242 |
| OLD | NEW |