Skip to content

Commit

Permalink
workaround for non-Chrome browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoes committed Aug 18, 2024
1 parent 2f3c313 commit da3fd69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/WebGL/Renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ export class Renderer {

this._currentWidth = this._viewportWidth;
this._currentHeight = this._viewportHeight;

this.setViewport();
this.setFrameBuffer();

Expand Down Expand Up @@ -2127,19 +2128,25 @@ export class Renderer {
private initGL() {

try {
if (OffscreenCanvas) {
//safari and firefox do not seem to respect alpha in transferFromImageBitmap
//and so can't use offscreen canvas with grids
if (OffscreenCanvas && this.rows == undefined &&
this.cols != undefined && this.row != undefined &&
this.col != undefined) {
if(_gl_singleton == null || _gl_singleton.isContextLost()) {
_offscreen_singleton = new OffscreenCanvas(this._canvas.width, this._canvas.height);
_gl_singleton = _offscreen_singleton.getContext("webgl2", {
alpha: this._alpha,
alpha: true,
premultipliedAlpha: this._premultipliedAlpha,
antialias: this._antialias,
preserveDrawingBuffer: this._preserveDrawingBuffer,
}) as WebGL2RenderingContext;
}
this._offscreen = _offscreen_singleton;
this._gl = _gl_singleton;
this._bitmap = this._canvas.getContext("bitmaprenderer");
this._bitmap = this._canvas.getContext("bitmaprenderer",{
alpha: true
});
} else {
if (
!(this._gl = this._canvas.getContext("webgl2", {
Expand Down
Binary file not shown.

0 comments on commit da3fd69

Please sign in to comment.