Skip to content

webgl support? #48

Answered by bitbof
stylehuan asked this question in Q&A
Discussion options

You must be logged in to vote

Klecks does some WebGL drawing through glfx.js. You can see its usage in filters, e.g. src/app/script/klecks/filters/filter-to-alpha.ts

let glCanvas = getSharedFx(); // get the glfx canvas (uses webgl)
let texture = glCanvas.texture(context.canvas); // turn current layer into a webgl texture
glCanvas.draw(texture).toAlpha(sourceId === 'inverted-luminance', selectedRgbaObj).update(); // apply toAlpha operation
// draw result back on layer
context.clearRect(0, 0, context.canvas.width, context.canvas.height);
context.drawImage(glCanvas, 0, 0);
texture.destroy(); // cleanup

Glfx code lives in src/app/script-vendor/glfx.ts.

Atm, everything outside of filters is done via CanvasRenderingContext2D.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by bitbof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #47 on September 24, 2022 15:08.