createTexture method

dynamic createTexture(
  1. int type,
  2. int target,
  3. int count
)

Implementation

createTexture(int type, int target, int count) {
  var data = Uint8Array(4);
  // 4 is required to match default unpack alignment of 4.
  //
  var texture = gl.createTexture();

  gl.bindTexture(type, texture);
  gl.texParameteri(type, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
  gl.texParameteri(type, gl.TEXTURE_MAG_FILTER, gl.NEAREST);

  for (var i = 0; i < count; i++) {
    gl.texImage2D(target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);
  }

  return texture;
}