initContext() { return getContext(2, 2, { preserveDrawingBuffer: true }); }
static setupFeatureChecks() { testCanvas = null; testExtensions = null; if (typeof getContext !== 'function') return; try { // just in case, edge cases testContext = getContext(2, 2, { preserveDrawingBuffer: true }); if (!testContext || !testContext.getExtension) return; testExtensions = { STACKGL_resize_drawingbuffer: testContext.getExtension('STACKGL_resize_drawingbuffer'), STACKGL_destroy_context: testContext.getExtension('STACKGL_destroy_context'), OES_texture_float: testContext.getExtension('OES_texture_float'), OES_texture_float_linear: testContext.getExtension('OES_texture_float_linear'), OES_element_index_uint: testContext.getExtension('OES_element_index_uint'), WEBGL_draw_buffers: testContext.getExtension('WEBGL_draw_buffers'), WEBGL_color_buffer_float: testContext.getExtension('WEBGL_color_buffer_float'), }; features = this.getFeatures(); } catch (e) { console.warn(e); } }
set width(value) { if(this.__gl__) { const ext = this.__gl__.getExtension('STACKGL_resize_drawingbuffer'); ext.resize(value, this.height); } super.width = value; }
const {width, height} = this; this[_ctx] = super.getContext('2d', options); const ctx = createGLContext(width, height, options); const _getUniformLocation = ctx.getUniformLocation;
set height(value) { if(this.__gl__) { const ext = this.__gl__.getExtension('STACKGL_resize_drawingbuffer'); ext.resize(this.width, value); } super.height = value; }