| 1126 | } |
| 1127 | |
| 1128 | function createTextureAsync (url) { |
| 1129 | let texture = gl.createTexture(); |
| 1130 | gl.bindTexture(gl.TEXTURE_2D, texture); |
| 1131 | gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); |
| 1132 | gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); |
| 1133 | gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); |
| 1134 | gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); |
| 1135 | gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, new Uint8Array([255, 255, 255])); |
| 1136 | |
| 1137 | let obj = { |
| 1138 | texture, |
| 1139 | width: 1, |
| 1140 | height: 1, |
| 1141 | attach (id) { |
| 1142 | gl.activeTexture(gl.TEXTURE0 + id); |
| 1143 | gl.bindTexture(gl.TEXTURE_2D, texture); |
| 1144 | return id; |
| 1145 | } |
| 1146 | }; |
| 1147 | |
| 1148 | let image = new Image(); |
| 1149 | image.onload = () => { |
| 1150 | obj.width = image.width; |
| 1151 | obj.height = image.height; |
| 1152 | gl.bindTexture(gl.TEXTURE_2D, texture); |
| 1153 | gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, image); |
| 1154 | }; |
| 1155 | image.src = url; |
| 1156 | |
| 1157 | return obj; |
| 1158 | } |
| 1159 | |
| 1160 | function updateKeywords () { |
| 1161 | let displayKeywords = []; |