# @maptalks/fusiongl

> [![Build Status](https://travis-ci.com/axmand/fusion.gl.svg?token=N2z4DqiFgBjde7FHSBe3&branch=master)](https://travis-ci.com/axmand/fusion.gl) [![npm version](https://badge.fury.io/js/fusion.gl.svg)](https://badge.fury.io/js/fusion.gl)

Latest version **0.124.4** (published 2026-03-04) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install @maptalks/fusiongl
pnpm add @maptalks/fusiongl
yarn add @maptalks/fusiongl
bun add @maptalks/fusiongl
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.124.4 |
| Published | 2026-03-04 |
| First published | 2019-01-05 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 29.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | axmand, fuzhenn |
| Maintainers | fuzhenn |

## Links

- npm: https://www.npmjs.com/package/@maptalks/fusiongl
- npm.io page: https://npm.io/package/@maptalks/fusiongl

## Dependencies (1)

- [fast-deep-equal](https://npm.io/package/fast-deep-equal.md) ^2.0.1

## Recent versions

- 0.124.4 (latest) — 2026-03-04
- 0.124.3 — 2026-02-11
- 0.124.2 — 2026-02-10
- 0.124.1 — 2026-02-06
- 0.124.0 — 2026-02-06
- 0.123.0 — 2026-01-28
- 0.122.0 — 2026-01-27
- 0.121.0 — 2026-01-26
- 0.120.0 — 2026-01-16
- 0.119.0 — 2026-01-12
- 0.118.1 — 2025-12-26
- 0.118.0 — 2025-12-26
- 0.117.1 — 2025-11-12
- 0.117.0 — 2025-11-11
- 0.116.0 — 2025-11-03
- … 41 more at https://npm.io/package/@maptalks/fusiongl/versions

## README

# fusion.gl
[![Build Status](https://travis-ci.com/axmand/fusion.gl.svg?token=N2z4DqiFgBjde7FHSBe3&branch=master)](https://travis-ci.com/axmand/fusion.gl)
[![npm version](https://badge.fury.io/js/fusion.gl.svg)](https://badge.fury.io/js/fusion.gl)
<!--[![codecov](https://codecov.io/gh/axmand/fusion.gl/branch/master/graph/badge.svg)](https://codecov.io/gh/axmand/fusion.gl)-->

一个WebGL沙盒库，它能基于同一个WebGL Context，扩展出多个沙盒WebGL环境，方便不同WebGL框架共享同一个WebGL Context。

它的主要特性：
* 模拟了全部WebGL1和部分WebGL2接口
* 每个沙盒WebGLContext的状态管理
* 切换沙盒时，自动设置WebGL Context上的状态值，例如stencil，depth，blend的相关状态
* 性能提升，如果检测到某个WebGL语句设置的状态已经被设置过，则不去运行该指令

## 示例程序
```js
import { GLContext } from '@maptalks/fusiongl';

const options = { alpha: true, depth: true };
const gl = canvas.getContext('webgl', options);
gl.wrap = () => {
  return new GLContext(this.gl);
};

// 在fusion.gl中的沙盒Context上创建Three的renderer
const renderer = new THREE.WebGLRenderer({ 'context': gl.wrap(), alpha: true });
```

---
_Source: https://npm.io/package/@maptalks/fusiongl · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
