MCPcopy Index your code
hub / github.com/PavelDoGreat/WebGL-Fluid-Simulation / captureScreenshot

Function captureScreenshot

script.js:287–299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

285}
286
287function captureScreenshot () {
288 let res = getResolution(config.CAPTURE_RESOLUTION);
289 let target = createFBO(res.width, res.height, ext.formatRGBA.internalFormat, ext.formatRGBA.format, ext.halfFloatTexType, gl.NEAREST);
290 render(target);
291
292 let texture = framebufferToTexture(target);
293 texture = normalizeTexture(texture, target.width, target.height);
294
295 let captureCanvas = textureToCanvas(texture, target.width, target.height);
296 let datauri = captureCanvas.toDataURL();
297 downloadURI('fluid.png', datauri);
298 URL.revokeObjectURL(datauri);
299}
300
301function framebufferToTexture (target) {
302 gl.bindFramebuffer(gl.FRAMEBUFFER, target.fbo);

Callers

nothing calls this directly

Calls 7

getResolutionFunction · 0.85
createFBOFunction · 0.85
renderFunction · 0.85
framebufferToTextureFunction · 0.85
normalizeTextureFunction · 0.85
textureToCanvasFunction · 0.85
downloadURIFunction · 0.85

Tested by

no test coverage detected