@gjsify/webgl 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -6
- package/lib/esm/canvas-webgl-widget.js +116 -0
- package/lib/esm/html-canvas-element.js +31 -50
- package/lib/esm/index.js +7 -0
- package/lib/esm/index.spec.js +629 -120
- package/lib/esm/test-utils.js +87 -0
- package/lib/esm/test.js +5 -1
- package/lib/esm/utils.js +1 -1
- package/lib/esm/webgl-active-info.js +2 -2
- package/lib/esm/webgl-buffer.js +2 -3
- package/lib/esm/webgl-context-attributes.js +2 -3
- package/lib/esm/webgl-framebuffer.js +3 -4
- package/lib/esm/webgl-program.js +2 -3
- package/lib/esm/webgl-query.js +15 -0
- package/lib/esm/webgl-renderbuffer.js +2 -3
- package/lib/esm/webgl-rendering-context.js +105 -101
- package/lib/esm/webgl-sampler.js +15 -0
- package/lib/esm/webgl-shader-precision-format.js +2 -3
- package/lib/esm/webgl-shader.js +2 -3
- package/lib/esm/webgl-sync.js +15 -0
- package/lib/esm/webgl-texture.js +2 -3
- package/lib/esm/webgl-transform-feedback.js +15 -0
- package/lib/esm/webgl-uniform-location.js +2 -3
- package/lib/esm/webgl-vertex-array-object.js +21 -0
- package/lib/esm/webgl2-rendering-context.js +591 -0
- package/lib/esm/webgl2.spec.js +578 -0
- package/lib/types/canvas-webgl-widget.d.ts +509 -0
- package/lib/types/extensions/ext-blend-minmax.d.ts +2 -2
- package/lib/types/extensions/ext-texture-filter-anisotropic.d.ts +2 -2
- package/lib/types/extensions/oes-element-index-unit.d.ts +2 -2
- package/lib/types/extensions/oes-standard-derivatives.d.ts +2 -2
- package/lib/types/extensions/oes-texture-float-linear.d.ts +2 -2
- package/lib/types/extensions/oes-texture-float.d.ts +2 -2
- package/lib/types/extensions/stackgl-destroy-context.d.ts +3 -3
- package/lib/types/extensions/stackgl-resize-drawing-buffer.d.ts +3 -3
- package/lib/types/html-canvas-element.d.ts +19 -30
- package/lib/types/index.d.ts +7 -0
- package/lib/types/test-utils.d.ts +45 -0
- package/lib/types/types/extension.d.ts +2 -2
- package/lib/types/utils.d.ts +14 -15
- package/lib/types/webgl-active-info.d.ts +1 -2
- package/lib/types/webgl-buffer.d.ts +5 -6
- package/lib/types/webgl-context-attributes.d.ts +1 -2
- package/lib/types/webgl-framebuffer.d.ts +4 -5
- package/lib/types/webgl-program.d.ts +4 -5
- package/lib/types/webgl-query.d.ts +7 -0
- package/lib/types/webgl-renderbuffer.d.ts +4 -5
- package/lib/types/webgl-rendering-context.d.ts +15 -12
- package/lib/types/webgl-sampler.d.ts +7 -0
- package/lib/types/webgl-shader-precision-format.d.ts +1 -2
- package/lib/types/webgl-shader.d.ts +4 -5
- package/lib/types/webgl-sync.d.ts +7 -0
- package/lib/types/webgl-texture-unit.d.ts +3 -3
- package/lib/types/webgl-texture.d.ts +6 -7
- package/lib/types/webgl-transform-feedback.d.ts +7 -0
- package/lib/types/webgl-uniform-location.d.ts +3 -4
- package/lib/types/webgl-vertex-array-object.d.ts +9 -0
- package/lib/types/webgl-vertex-attribute.d.ts +5 -5
- package/lib/types/webgl2-rendering-context.d.ts +124 -0
- package/package.json +27 -26
- package/prebuilds/linux-aarch64/Gwebgl-0.1.typelib +0 -0
- package/prebuilds/linux-aarch64/libgwebgl.so +0 -0
- package/prebuilds/linux-x86_64/Gwebgl-0.1.typelib +0 -0
- package/prebuilds/linux-x86_64/libgwebgl.so +0 -0
- package/lib/cjs/@types/glsl-tokenizer/index.d.js +0 -0
- package/lib/cjs/extensions/ext-blend-minmax.js +0 -18
- package/lib/cjs/extensions/ext-texture-filter-anisotropic.js +0 -18
- package/lib/cjs/extensions/oes-element-index-unit.js +0 -14
- package/lib/cjs/extensions/oes-standard-derivatives.js +0 -17
- package/lib/cjs/extensions/oes-texture-float-linear.js +0 -14
- package/lib/cjs/extensions/oes-texture-float.js +0 -14
- package/lib/cjs/extensions/stackgl-destroy-context.js +0 -12
- package/lib/cjs/extensions/stackgl-resize-drawing-buffer.js +0 -12
- package/lib/cjs/html-canvas-element.js +0 -70
- package/lib/cjs/index.js +0 -18
- package/lib/cjs/index.spec.js +0 -146
- package/lib/cjs/linkable.js +0 -50
- package/lib/cjs/test.js +0 -3
- package/lib/cjs/types/constructor.js +0 -0
- package/lib/cjs/types/extension.js +0 -0
- package/lib/cjs/types/index.js +0 -5
- package/lib/cjs/types/typed-array.js +0 -0
- package/lib/cjs/types/webgl-constants.js +0 -0
- package/lib/cjs/types/webgl-context-attribute-options.js +0 -0
- package/lib/cjs/utils.js +0 -212
- package/lib/cjs/webgl-active-info.js +0 -10
- package/lib/cjs/webgl-buffer.js +0 -18
- package/lib/cjs/webgl-context-attributes.js +0 -24
- package/lib/cjs/webgl-drawing-buffer-wrapper.js +0 -10
- package/lib/cjs/webgl-framebuffer.js +0 -109
- package/lib/cjs/webgl-program.js +0 -26
- package/lib/cjs/webgl-renderbuffer.js +0 -24
- package/lib/cjs/webgl-rendering-context.js +0 -3343
- package/lib/cjs/webgl-shader-precision-format.js +0 -11
- package/lib/cjs/webgl-shader.js +0 -23
- package/lib/cjs/webgl-texture-unit.js +0 -12
- package/lib/cjs/webgl-texture.js +0 -22
- package/lib/cjs/webgl-uniform-location.js +0 -15
- package/lib/cjs/webgl-vertex-attribute.js +0 -147
- package/meson.build +0 -39
- package/src/test/app.vala +0 -60
- package/src/ts/@types/glsl-tokenizer/index.d.ts +0 -18
- package/src/ts/extensions/angle-instanced-arrays.ts.off +0 -232
- package/src/ts/extensions/ext-blend-minmax.ts +0 -18
- package/src/ts/extensions/ext-texture-filter-anisotropic.ts +0 -18
- package/src/ts/extensions/oes-element-index-unit.ts +0 -14
- package/src/ts/extensions/oes-standard-derivatives.ts +0 -17
- package/src/ts/extensions/oes-texture-float-linear.ts +0 -14
- package/src/ts/extensions/oes-texture-float.ts +0 -14
- package/src/ts/extensions/oes-vertex-array-object.ts.off +0 -128
- package/src/ts/extensions/stackgl-destroy-context.ts +0 -12
- package/src/ts/extensions/stackgl-resize-drawing-buffer.ts +0 -14
- package/src/ts/extensions/webgl-draw-buffers.ts.off +0 -107
- package/src/ts/html-canvas-element.ts +0 -98
- package/src/ts/index.spec.ts +0 -186
- package/src/ts/index.ts +0 -21
- package/src/ts/linkable.ts +0 -55
- package/src/ts/test.ts +0 -6
- package/src/ts/types/constructor.ts +0 -3
- package/src/ts/types/extension.ts +0 -3
- package/src/ts/types/index.ts +0 -26
- package/src/ts/types/typed-array.ts +0 -1
- package/src/ts/types/webgl-constants.ts +0 -300
- package/src/ts/types/webgl-context-attribute-options.ts +0 -12
- package/src/ts/utils.ts +0 -266
- package/src/ts/webgl-active-info.ts +0 -13
- package/src/ts/webgl-buffer.ts +0 -21
- package/src/ts/webgl-context-attributes.ts +0 -24
- package/src/ts/webgl-drawing-buffer-wrapper.ts +0 -10
- package/src/ts/webgl-framebuffer.ts +0 -133
- package/src/ts/webgl-program.ts +0 -30
- package/src/ts/webgl-renderbuffer.ts +0 -28
- package/src/ts/webgl-rendering-context.ts +0 -4050
- package/src/ts/webgl-shader-precision-format.ts +0 -12
- package/src/ts/webgl-shader.ts +0 -29
- package/src/ts/webgl-texture-unit.ts +0 -16
- package/src/ts/webgl-texture.ts +0 -27
- package/src/ts/webgl-uniform-location.ts +0 -18
- package/src/ts/webgl-vertex-attribute.ts +0 -169
- package/src/vala/handle-types.vala +0 -23
- package/src/vala/webgl-rendering-context-base.vala +0 -1265
- package/src/vala/webgl-rendering-context.vala +0 -265
- package/src/vapi/epoxy.vapi +0 -14558
- package/src/vapi/glesv2.vapi +0 -670
- package/test.gjs.js +0 -39972
- package/test.gjs.js.meta.json +0 -1
- package/tmp/.tsbuildinfo +0 -1
- package/tsconfig.json +0 -38
- package/tsconfig.types.json +0 -7
package/README.md
CHANGED
|
@@ -1,14 +1,86 @@
|
|
|
1
1
|
# @gjsify/webgl
|
|
2
2
|
|
|
3
|
-
WebGL
|
|
3
|
+
GJS implementation of WebGL 1.0/2.0 using a custom Vala extension (gwebgl). Provides CanvasWebGLWidget extending Gtk.GLArea.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
|
|
6
6
|
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @gjsify/webgl
|
|
11
|
+
# or
|
|
12
|
+
yarn add @gjsify/webgl
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { CanvasWebGLWidget } from '@gjsify/webgl';
|
|
19
|
+
|
|
20
|
+
const widget = new CanvasWebGLWidget();
|
|
21
|
+
widget.installGlobals();
|
|
22
|
+
|
|
23
|
+
widget.onReady((canvas, gl) => {
|
|
24
|
+
gl.clearColor(0, 0, 0, 1);
|
|
25
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
window.set_child(widget);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Running GJS apps that use this package
|
|
32
|
+
|
|
33
|
+
This package ships prebuilt native libraries for supported platforms:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
prebuilds/
|
|
37
|
+
linux-x86_64/ libgwebgl.so + Gwebgl-0.1.typelib
|
|
38
|
+
linux-aarch64/ libgwebgl.so + Gwebgl-0.1.typelib
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Use the gjsify CLI to run your app — it automatically sets `LD_LIBRARY_PATH` and
|
|
42
|
+
`GI_TYPELIB_PATH` so GJS can find the native library:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
gjsify run dist/gjs.js
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
To see what env vars are needed for running directly with `gjs`:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
gjsify info dist/gjs.js
|
|
52
|
+
# or for shell eval:
|
|
53
|
+
eval $(gjsify info --export)
|
|
54
|
+
gjs -m dist/gjs.js
|
|
7
55
|
```
|
|
8
|
-
|
|
56
|
+
|
|
57
|
+
## Building the native library locally
|
|
58
|
+
|
|
59
|
+
Requires: `meson`, `valac`, `gcc`, `libepoxy-devel`, `gtk4-devel`, `gdk-pixbuf2-devel`, `gobject-introspection-devel`
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Fedora / RHEL
|
|
63
|
+
sudo dnf install meson vala gcc libepoxy-devel gtk4-devel gdk-pixbuf2-devel gobject-introspection-devel
|
|
64
|
+
|
|
65
|
+
# Build
|
|
66
|
+
yarn build:meson
|
|
67
|
+
|
|
68
|
+
# Build and copy to prebuilds/ for the current architecture
|
|
69
|
+
yarn build:prebuilds
|
|
9
70
|
```
|
|
10
71
|
|
|
72
|
+
## Prebuilt binaries
|
|
73
|
+
|
|
74
|
+
Prebuilds for `linux-x86_64` and `linux-aarch64` are built automatically by CI
|
|
75
|
+
(`.github/workflows/prebuilds.yml`) when the Vala source changes and committed back
|
|
76
|
+
to the repository. They are included in the npm package via the `files` field.
|
|
77
|
+
|
|
11
78
|
## Inspirations and credits
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
79
|
+
|
|
80
|
+
- [realh/gwebgl](https://github.com/realh/gwebgl)
|
|
81
|
+
- [stackgl/headless-gl](https://github.com/stackgl/headless-gl)
|
|
82
|
+
- [Maia-Everett/valagl](https://github.com/Maia-Everett/valagl)
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import GObject from "gi://GObject";
|
|
2
|
+
import GLib from "gi://GLib?version=2.0";
|
|
3
|
+
import Gtk from "gi://Gtk?version=4.0";
|
|
4
|
+
import { HTMLCanvasElement as OurHTMLCanvasElement } from "./html-canvas-element.js";
|
|
5
|
+
import { attachEventControllers } from "@gjsify/event-bridge";
|
|
6
|
+
const CanvasWebGLWidget = GObject.registerClass(
|
|
7
|
+
{ GTypeName: "GjsifyCanvasWebGLWidget" },
|
|
8
|
+
class CanvasWebGLWidget2 extends Gtk.GLArea {
|
|
9
|
+
constructor(params) {
|
|
10
|
+
super(params);
|
|
11
|
+
this._canvas = null;
|
|
12
|
+
this._readyCallbacks = [];
|
|
13
|
+
this._renderTag = null;
|
|
14
|
+
this._tickCallbackId = null;
|
|
15
|
+
this._frameCallback = null;
|
|
16
|
+
// Time origin in microseconds (GLib monotonic clock).
|
|
17
|
+
// Both requestAnimationFrame timestamps and performance.now() are
|
|
18
|
+
// relative to this origin, matching the browser DOMHighResTimeStamp spec.
|
|
19
|
+
this._timeOrigin = GLib.get_monotonic_time();
|
|
20
|
+
this.set_use_es(true);
|
|
21
|
+
this.set_required_version(3, 2);
|
|
22
|
+
this.set_has_depth_buffer(true);
|
|
23
|
+
this.set_has_stencil_buffer(true);
|
|
24
|
+
attachEventControllers(this, () => this._canvas);
|
|
25
|
+
const initId = this.connect("render", () => {
|
|
26
|
+
this.disconnect(initId);
|
|
27
|
+
this.make_current();
|
|
28
|
+
this._canvas = new OurHTMLCanvasElement(this);
|
|
29
|
+
const gl = this._canvas.getContext("webgl");
|
|
30
|
+
if (gl) {
|
|
31
|
+
for (const cb of this._readyCallbacks) {
|
|
32
|
+
cb(this._canvas, gl);
|
|
33
|
+
}
|
|
34
|
+
this._readyCallbacks = [];
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
});
|
|
38
|
+
this.connect("unrealize", () => {
|
|
39
|
+
if (this._renderTag !== null) {
|
|
40
|
+
this.disconnect(this._renderTag);
|
|
41
|
+
this._renderTag = null;
|
|
42
|
+
}
|
|
43
|
+
if (this._tickCallbackId !== null) {
|
|
44
|
+
this.remove_tick_callback(this._tickCallbackId);
|
|
45
|
+
this._tickCallbackId = null;
|
|
46
|
+
}
|
|
47
|
+
this._canvas = null;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** The HTMLCanvasElement wrapping this GLArea. Available after the first render. */
|
|
51
|
+
get canvas() {
|
|
52
|
+
return this._canvas;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Registers a callback to be called once the WebGL context is ready.
|
|
56
|
+
* If the context is already available, the callback fires synchronously.
|
|
57
|
+
*/
|
|
58
|
+
onReady(cb) {
|
|
59
|
+
if (this._canvas) {
|
|
60
|
+
const gl = this._canvas.getContext("webgl");
|
|
61
|
+
if (gl) {
|
|
62
|
+
cb(this._canvas, gl);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
this._readyCallbacks.push(cb);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated Use `onReady()` instead.
|
|
70
|
+
*/
|
|
71
|
+
onWebGLReady(cb) {
|
|
72
|
+
this.onReady(cb);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Schedules a single animation frame callback, matching the browser `requestAnimationFrame` API.
|
|
76
|
+
* Backed by GTK frame clock (vsync-synced) + the GLArea render signal.
|
|
77
|
+
* Returns 0 (handle — cancel not yet implemented).
|
|
78
|
+
*/
|
|
79
|
+
requestAnimationFrame(cb) {
|
|
80
|
+
this._frameCallback = cb;
|
|
81
|
+
if (this._tickCallbackId === null) {
|
|
82
|
+
this._tickCallbackId = this.add_tick_callback((_widget, _frameClock) => {
|
|
83
|
+
this._tickCallbackId = null;
|
|
84
|
+
if (this._renderTag === null) {
|
|
85
|
+
this._renderTag = this.connect("render", () => {
|
|
86
|
+
this.disconnect(this._renderTag);
|
|
87
|
+
this._renderTag = null;
|
|
88
|
+
const time = (GLib.get_monotonic_time() - this._timeOrigin) / 1e3;
|
|
89
|
+
this._frameCallback?.(time);
|
|
90
|
+
return true;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
this.queue_render();
|
|
94
|
+
return GLib.SOURCE_REMOVE;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
this.queue_render();
|
|
98
|
+
return 0;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Sets browser globals (`requestAnimationFrame`, `performance`) so that
|
|
102
|
+
* browser-targeted code (e.g. Three.js) works unchanged on GJS.
|
|
103
|
+
*/
|
|
104
|
+
installGlobals() {
|
|
105
|
+
globalThis.requestAnimationFrame = (cb) => this.requestAnimationFrame(cb);
|
|
106
|
+
const timeOrigin = this._timeOrigin;
|
|
107
|
+
globalThis.performance = {
|
|
108
|
+
now: () => (GLib.get_monotonic_time() - timeOrigin) / 1e3,
|
|
109
|
+
timeOrigin: Date.now()
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
export {
|
|
115
|
+
CanvasWebGLWidget
|
|
116
|
+
};
|
|
@@ -1,70 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { HTMLCanvasElement as BaseHTMLCanvasElement } from "@gjsify/dom-elements";
|
|
2
|
+
import { WebGLRenderingContext as OurWebGLRenderingContext } from "./webgl-rendering-context.js";
|
|
3
|
+
import { WebGL2RenderingContext as OurWebGL2RenderingContext } from "./webgl2-rendering-context.js";
|
|
4
|
+
class HTMLCanvasElement extends BaseHTMLCanvasElement {
|
|
4
5
|
constructor(gtkGlArea) {
|
|
6
|
+
super();
|
|
5
7
|
this.gtkGlArea = gtkGlArea;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
/** Width from the GTK GLArea allocated size (overrides DOM attr-backed getter). */
|
|
10
|
+
get width() {
|
|
11
|
+
return this.gtkGlArea.get_allocated_width();
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
set width(_width) {
|
|
14
|
+
}
|
|
15
|
+
/** Height from the GTK GLArea allocated size (overrides DOM attr-backed getter). */
|
|
11
16
|
get height() {
|
|
12
17
|
return this.gtkGlArea.get_allocated_height();
|
|
13
18
|
}
|
|
14
|
-
get clientHeight() {
|
|
15
|
-
return this.height;
|
|
16
|
-
}
|
|
17
|
-
/** Sets the height of a canvas element on a document. */
|
|
18
19
|
set height(_height) {
|
|
19
|
-
warnNotImplemented("GjsifyHTMLCanvasElement.set_height");
|
|
20
|
-
}
|
|
21
|
-
/** Gets the width of a canvas element on a document. */
|
|
22
|
-
get width() {
|
|
23
|
-
return this.gtkGlArea.get_allocated_width();
|
|
24
|
-
}
|
|
25
|
-
/** Sets the width of a canvas element on a document. */
|
|
26
|
-
set width(_width) {
|
|
27
|
-
warnNotImplemented("GjsifyHTMLCanvasElement.set_width");
|
|
28
20
|
}
|
|
29
21
|
get clientWidth() {
|
|
30
22
|
return this.width;
|
|
31
23
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return new MediaStream();
|
|
35
|
-
}
|
|
36
|
-
getContext(contextId, options) {
|
|
37
|
-
switch (contextId) {
|
|
38
|
-
case "webgl":
|
|
39
|
-
if (this._webgl) {
|
|
40
|
-
return this._webgl;
|
|
41
|
-
}
|
|
42
|
-
this._webgl = new GjsifyWebGLRenderingContext(this, options);
|
|
43
|
-
return this._webgl;
|
|
44
|
-
default:
|
|
45
|
-
warnNotImplemented(`GjsifyHTMLCanvasElement.getContext("${contextId}")`);
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
24
|
+
get clientHeight() {
|
|
25
|
+
return this.height;
|
|
48
26
|
}
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
/** Returns the underlying Gtk.GLArea. Used by WebGLRenderingContext for GLSL version detection. */
|
|
28
|
+
getGlArea() {
|
|
29
|
+
return this.gtkGlArea;
|
|
51
30
|
}
|
|
52
31
|
/**
|
|
53
|
-
* Returns
|
|
54
|
-
*
|
|
32
|
+
* Returns a WebGL rendering context backed by the underlying Gtk.GLArea.
|
|
33
|
+
* 'webgl' and 'experimental-webgl' return a WebGLRenderingContext (WebGL 1.0).
|
|
34
|
+
* 'webgl2' returns a WebGL2RenderingContext (WebGL 2.0).
|
|
35
|
+
* Other context types emit a warning and return null.
|
|
55
36
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
37
|
+
getContext(contextId, options) {
|
|
38
|
+
if (contextId === "webgl" || contextId === "experimental-webgl") {
|
|
39
|
+
this._webgl ??= new OurWebGLRenderingContext(this, options);
|
|
40
|
+
return this._webgl;
|
|
41
|
+
}
|
|
42
|
+
if (contextId === "webgl2") {
|
|
43
|
+
this._webgl2 ??= new OurWebGL2RenderingContext(this, options);
|
|
44
|
+
return this._webgl2;
|
|
45
|
+
}
|
|
46
|
+
return super.getContext(contextId, options);
|
|
65
47
|
}
|
|
66
48
|
}
|
|
67
49
|
export {
|
|
68
|
-
|
|
69
|
-
GjsifyHTMLCanvasElement as HTMLCanvasElement
|
|
50
|
+
HTMLCanvasElement
|
|
70
51
|
};
|
package/lib/esm/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import "@girs/gjs";
|
|
|
2
2
|
import "@girs/gio-2.0";
|
|
3
3
|
import "@girs/gtk-4.0";
|
|
4
4
|
export * from "./html-canvas-element.js";
|
|
5
|
+
export * from "./canvas-webgl-widget.js";
|
|
5
6
|
export * from "./webgl-active-info.js";
|
|
6
7
|
export * from "./webgl-buffer.js";
|
|
7
8
|
export * from "./webgl-context-attributes.js";
|
|
@@ -9,8 +10,14 @@ export * from "./webgl-drawing-buffer-wrapper.js";
|
|
|
9
10
|
export * from "./webgl-framebuffer.js";
|
|
10
11
|
export * from "./webgl-program.js";
|
|
11
12
|
export * from "./webgl-renderbuffer.js";
|
|
13
|
+
export * from "./webgl-query.js";
|
|
12
14
|
export * from "./webgl-rendering-context.js";
|
|
15
|
+
export * from "./webgl-sampler.js";
|
|
13
16
|
export * from "./webgl-shader-precision-format.js";
|
|
17
|
+
export * from "./webgl-sync.js";
|
|
18
|
+
export * from "./webgl-transform-feedback.js";
|
|
19
|
+
export * from "./webgl-vertex-array-object.js";
|
|
20
|
+
export * from "./webgl2-rendering-context.js";
|
|
14
21
|
export * from "./webgl-shader.js";
|
|
15
22
|
export * from "./webgl-texture-unit.js";
|
|
16
23
|
export * from "./webgl-texture.js";
|