MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / constructor

Method constructor

src/tools/texture-lab/renderer.js:62–79  ·  view source on GitHub ↗
(canvas)

Source from the content-addressed store, hash-verified

60
61export class WebGLRenderer {
62 constructor(canvas) {
63 this.canvas = canvas;
64 this.gl = canvas.getContext('webgl2') || canvas.getContext('webgl');
65
66 if (!this.gl) {
67 throw new Error('WebGL not supported');
68 }
69
70 this.programs = {};
71 this.textures = {};
72 this.framebuffers = [];
73 this.quadBuffer = null;
74 this.texCoordBuffer = null;
75 this.currentCharset = null;
76
77 this._initBuffers();
78 this._initPrograms();
79 }
80
81 _initBuffers() {
82 const gl = this.gl;

Callers

nothing calls this directly

Calls 2

_initBuffersMethod · 0.95
_initProgramsMethod · 0.95

Tested by

no test coverage detected