wrapExternalColorTarget function Rendering

Texture wrapExternalColorTarget(
  1. Object handle, {
  2. required int width,
  3. required int height,
  4. ExternalTargetHandleKind kind = gpu.ExternalTargetHandleKind.framebuffer,
  5. PixelFormat format = gpu.PixelFormat.r8g8b8a8UNormInt,
})

Wraps handle, a platform color target, as a texture a scene can render into through an ExternalRenderTarget.

On the web, handle is a WebGLFramebuffer (gpu.ExternalTargetHandleKind.framebuffer) or a WebGLTexture (gpu.ExternalTargetHandleKind.texture) created on nativeGraphicsContext. The caller keeps ownership and must not delete it while a scene renders into it. Throws UnsupportedError where externalColorTargetsSupported is false.

Implementation

gpu.Texture wrapExternalColorTarget(
  Object handle, {
  required int width,
  required int height,
  gpu.ExternalTargetHandleKind kind = gpu.ExternalTargetHandleKind.framebuffer,
  gpu.PixelFormat format = gpu.PixelFormat.r8g8b8a8UNormInt,
}) => gpu.gpuHost.wrapExternalColorTarget(
  handle,
  width: width,
  height: height,
  kind: kind,
  format: format,
);