texImage2DfromAsset method

Future<void> texImage2DfromAsset(
  1. int target,
  2. String asset, {
  3. int level = 0,
  4. int internalformat = WebGL.RGBA,
  5. int format = WebGL.RGBA,
  6. int type = WebGL.UNSIGNED_BYTE,
})

Implementation

Future<void> texImage2DfromAsset(
  int target,
  String asset, {
  int level = 0,
  int internalformat = WebGL.RGBA,
  int format = WebGL.RGBA,
  int type = WebGL.UNSIGNED_BYTE,
}) async {
  final completer = Completer<void>();
  final imageDom = html.ImageElement();
  imageDom.crossOrigin = "";
  imageDom.src = asset;
  imageDom.onLoad.listen((e) {
    texImage2D_NOSIZE(target, level, internalformat, format, type, imageDom);
    completer.complete();
  });

  return completer.future;
}