()
| 17 | } |
| 18 | |
| 19 | static setupFeatureChecks() { |
| 20 | testCanvas = null; |
| 21 | testExtensions = null; |
| 22 | if (typeof getContext !== 'function') return; |
| 23 | try { // just in case, edge cases |
| 24 | testContext = getContext(2, 2, { |
| 25 | preserveDrawingBuffer: true |
| 26 | }); |
| 27 | if (!testContext || !testContext.getExtension) return; |
| 28 | testExtensions = { |
| 29 | STACKGL_resize_drawingbuffer: testContext.getExtension('STACKGL_resize_drawingbuffer'), |
| 30 | STACKGL_destroy_context: testContext.getExtension('STACKGL_destroy_context'), |
| 31 | OES_texture_float: testContext.getExtension('OES_texture_float'), |
| 32 | OES_texture_float_linear: testContext.getExtension('OES_texture_float_linear'), |
| 33 | OES_element_index_uint: testContext.getExtension('OES_element_index_uint'), |
| 34 | WEBGL_draw_buffers: testContext.getExtension('WEBGL_draw_buffers'), |
| 35 | WEBGL_color_buffer_float: testContext.getExtension('WEBGL_color_buffer_float'), |
| 36 | }; |
| 37 | features = this.getFeatures(); |
| 38 | } catch (e) { |
| 39 | console.warn(e); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | static isContextMatch(context) { |
| 44 | try { |
no test coverage detected