setupTexture method
Creates a new texture and sets the material uniforms texture location.
Implementation
void setupTexture(MeshBasicMaterial material) {
int width = material.mapWidth!;
int height = material.mapHeigth!;
int texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, material.map);
gl.generateMipmap(gl.TEXTURE_2D);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
material.uniforms['u_texture'] = texture;
}