HTMLCanvasElement: webglcontextrestored event

Nasi wolontariusze nie przetłumaczyli jeszcze tego artykułu na język Polski. Dołącz do nas i pomóż go przetłumaczyć!
Można także przeczytać artykuł w języku: English (US).

The webglcontextrestored event of the WebGL API is fired if the user agent restores the drawing buffer for a WebGLRenderingContext object.

Once the context is restored, WebGL resources such as textures and buffers that were created before the context was lost are no longer valid. You need to reinitialize the state of your WebGL application and recreate resources.

Bubbles Yes
Cancelable Yes
Interface WebGLContextEvent
Event handler property none

Example

With the help of the WEBGL_lose_context extension, you can simulate the webglcontextrestored event:

var canvas = document.getElementById('canvas');
var gl = canvas.getContext('webgl');

canvas.addEventListener('webglcontextrestored', function(e) {
  console.log(e); 
}, false);

gl.getExtension('WEBGL_lose_context').restoreContext();

// "webglcontextrestored" event is logged.

Specifications

Specification Status Comment
WebGL 1.0
The definition of 'webglcontextrestored' in that specification.
Recommendation Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
webglcontextrestored eventChrome Full support 9Edge Full support 12Firefox Full support 4IE Full support 11Opera Full support 12Safari Full support 5.1WebView Android Full support YesChrome Android Full support 25Firefox Android Full support 4Opera Android Full support 12Safari iOS Full support 8Samsung Internet Android Full support Yes

Legend

Full support  
Full support

See also

Autorzy i etykiety dokumentu

Etykiety: 
Autorzy tej strony: mdnwebdocs-bot, fscholz, nmve, erikadoyle, teoli
Ostatnia aktualizacja: mdnwebdocs-bot,