0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-15 03:28:25 -05:00
penpot/frontend/render_v2/cpp/js/preamble.js
2024-10-02 12:35:05 +02:00

20 lines
703 B
JavaScript

// Adds compile-time JS functions to augment Renderer interface.
(function (Renderer) {
console.log("preamble", Renderer);
Renderer.setCanvas = function setCanvas(canvas, attrs) {
console.log("GL", GL);
debugger
const context = GL.createContext(canvas, attrs);
if (!context) {
throw new Error('Could not create a new WebGL context')
}
GL.makeContextCurrent(context);
// Emscripten does not enable this by default and Skia needs this
// to handle certain GPU corner cases.
GL.currentContext.GLctx.getExtension('WEBGL_debug_renderer_info');
console.log("setCanvas", canvas, attrs);
const gr = this._MakeGrContext();
console.log("gr", gr);
};