texImage2DfromImage method
Future<void>
texImage2DfromImage(
- int target,
- Image image, {
- int level = 0,
- int internalformat = WebGL.RGBA,
- int format = WebGL.RGBA,
- int type = WebGL.UNSIGNED_BYTE,
})
Implementation
Future<void> texImage2DfromImage(
int target,
Image image, {
int level = 0,
int internalformat = WebGL.RGBA,
int format = WebGL.RGBA,
int type = WebGL.UNSIGNED_BYTE,
}) async {
final completer = Completer<void>();
final bytes = (await image.toByteData())!;
final hblob = html.Blob([bytes]);
final imageDom = html.ImageElement();
imageDom.crossOrigin = "";
imageDom.src = html.Url.createObjectUrl(hblob);
imageDom.onLoad.listen((e) {
completer.complete();
texImage2D_NOSIZE(target, level, internalformat, format, type, imageDom);
});
return completer.future;
}