This is a small script that lets you record the WebGL calls of any app for playback later. Example use case: create an easily reproducible test case of a complex WebGL app that demonstrates a browser bug.
- Clone this repo
- Open demo/app.html in your browser
- Wait until you want to stop recording, then click "Download Trace" (recording starts immediately)
- Move the saved "trace.js" file next to demo/playback.html on your local machine
- Open demo/playback.html in your browser to view the playback
Add <script src="webgl-recorder.js"></script>
to the page containing the WebGL code you want to record.
All WebGL contexts will begin recording immediately.
If gl
is the WebGLRenderingContext
, the current trace is accessible off of gl.trace
.
The trace can be compiled to JavaScript playback code and then downloaded to a file using gl.downloadTrace()
, or just compiled to a string without downloading using gl.compileTrace()
.
This code is licensed under CC0.