Skip to content

WebGLRenderingContext.texImage2D doesn't allow passing ImageBitmap as a parameter #26364

@Fox32

Description

@Fox32

I would like to pass a ImageBitmapfor the border_OR_canvas_OR_image_OR_pixels_OR_video parameter of WebGLRenderingContext.texImage2D. However, internaly texImage2D checks for the type of the parameter and only allows ImageData, ImageElement, CanvasElementor VideoElement and throws an argument error otherwise.

For now I was able hack something together with dart:js that works, however it would be easier if I could just pass the parameter. I'm not sure if it's the easiest way to achieve it, but if anyone has a better idea, I would be happy about a response:

      final glEx = new JsObject.fromBrowserObject(context);

      glEx['o'].callMethod('texImage2D', [_textureTarget, 0, pixelFormat, pixelFormat, pixelDataType, new JsObject.fromBrowserObject(element)['o']]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-webgl

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions