PageSourceSearch

https://blog.numedu.org/wp-content/plugins/wp-3d-thingviewer-lite/…/libraries/three-js-r145/WebGL.js?ver=3.2

js numedu.org collected 2026-10-07 03:17:46 UTC 1,776 bytes, 90 lines download raw bytes

1( function () {
2
3	class WEBGL {
4
5		static isWebGLAvailable() {
6
7			try {
8
9				const canvas = document.createElement( 'canvas' );
10				return !! ( window.WebGLRenderingContext && ( canvas.getContext( 'webgl' ) || canvas.getContext( 'experimental-webgl' ) ) );
11
12			} catch ( e ) {
13
14				return false;
15
16			}
17
18		}
19
20		static isWebGL2Available() {
21
22			try {
23
24				const canvas = document.createElement( 'canvas' );
25				return !! ( window.WebGL2RenderingContext && canvas.getContext( 'webgl2' ) );
26
27			} catch ( e ) {
28
29				return false;
30
31			}
32
33		}
34
35		static getWebGLErrorMessage() {
36
37			return this.getErrorMessage( 1 );
38
39		}
40
41		static getWebGL2ErrorMessage() {
42
43			return this.getErrorMessage( 2 );
44
45		}
46
47		static getErrorMessage( version ) {
48
49			const names = {
50				1: 'WebGL',
51				2: 'WebGL 2'
52			};
53			const contexts = {
54				1: window.WebGLRenderingContext,
55				2: window.WebGL2RenderingContext
56			};
57			let message = 'Your $0 does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">$1</a>';
58			const element = document.createElement( 'div' );
59			element.id = 'webglmessage';
60			element.style.fontFamily = 'monospace';
61			element.style.fontSize = '13px';
62			element.style.fontWeight = 'normal';
63			element.style.textAlign = 'center';
64			element.style.background = '#fff';
65			element.style.color = '#000';
66			element.style.padding = '1.5em';
67			element.style.width = '400px';
68			element.style.margin = '5em auto 0';
69
70			if ( contexts[ version ] ) {
71
72				message = message.replace( '$0', 'graphics card' );
73
74			} else {
75
76				message = message.replace( '$0', 'browser' );
77
78			}
79
80			message = message.replace( '$1', names[ version ] );
81			element.innerHTML = message;
82			return element;
83
84		}
85
86	}
87
88	THREE.WEBGL = WEBGL;
89
90} )();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.