Skip to content

Commit

Permalink
fix up radial blur filter and canvas extract on webGPU
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodBoyDigital committed Feb 1, 2024
1 parent f1eab25 commit c630188
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions scripts/screenshots/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ const outputOptions = {
},
};

const indexCount = 0;

const app = new Application();

app.init({
width: outputOptions.width,
height: outputOptions.height,
backgroundColor: outputOptions.border.color,
autoStart: false,
preference: 'webgl',
preference: 'webgpu',
hello: true,
}).then(() =>
{
Expand Down Expand Up @@ -163,8 +165,15 @@ app.init({
app.render();
const canvas = app.renderer.extract.canvas(app.stage);

const canvas2 = document.createElement('canvas');

canvas2.width = canvas.width;
canvas2.height = canvas.height;

document.body.appendChild(canvas);
const context = canvas.getContext('2d');
const context = canvas2.getContext('2d');

context.drawImage(canvas, 0, 0);

context.scale(1, -1);
const imageData = context.getImageData(0, 0, outputOptions.width, outputOptions.height);
Expand Down
2 changes: 1 addition & 1 deletion src/radial-blur/RadialBlurFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class RadialBlurFilter extends Filter
radialBlurUniforms: {
uRadian: { value: 0, type: 'f32' },
uCenter: { value: options.center, type: 'vec2<f32>' },
uKernelSize: { value: options.kernelSize, type: 'f32' },
uKernelSize: { value: options.kernelSize, type: 'i32' },
uRadius: { value: options.radius, type: 'f32' },
}
},
Expand Down

0 comments on commit c630188

Please sign in to comment.