attachOpenGlBorrowedTexture method

RenderSessionHandle attachOpenGlBorrowedTexture(
  1. OpenGlBorrowedTextureDescriptor descriptor,
  2. RenderSessionAttachOptions options
)

Creates a session that renders the map into a ring of your OpenGL textures.

See mln_map_attach_open_gl_borrowed_texture in the C API reference.

Errors:

  • Status.unsupported when openGlSupportedContextProviderMask() lacks the context's platform, or when the target supports none of the producer_sync_kinds in options.

Implementation

RenderSessionHandle attachOpenGlBorrowedTexture(
  OpenGlBorrowedTextureDescriptor descriptor,
  RenderSessionAttachOptions options,
) {
  final registrations = _NativeRegistrations(_CallbackRoots());
  return _attach(
    (arena, completion, outSession) => registrations.run(
      () => raw.mln_map_attach_open_gl_borrowed_texture(
        _handle.raw,
        _writeOpenGlBorrowedTextureDescriptor(descriptor, arena),
        _writeRenderSessionAttachOptions(options, arena, registrations),
        outSession,
        completion,
        nativeDiagnostic,
      ),
    ),
    (handle, ready) => _adoptOwned(
      handle,
      () =>
          (RenderSessionHandle._(this, _NativeRenderSession(handle), ready)
            .._state.retain(registrations)),
      (handle) {
        _check(raw.mln_render_session_dispose(handle, nativeDiagnostic));
      },
    ),
  );
}