I'm using headless-gl together with node to render a high-res generated WebGL image on the server-side. This works fine depending on the chosen resolution.
'use strict';
const Gl = require('gl');
const width = 7200;
const height = 10800;
// Setup renderer using headless-gl
const gl = Gl(width, height, { preserveDrawingBuffer: true })
// Clear screen to red
gl.clearColor(1, 0, 0, 1)
gl.clear(gl.COLOR_BUFFER_BIT)
// Get pixels
const pixels = new Uint8Array(width * height * 4);
gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
// Is first color indeed red?
if (pixels[0] === 255) {
console.log('OK');
}
process.exit();
After some point of increasing the width/height values the pixels array is filled with only zero values for the rgba pixels. I'm guessing that I'm hitting a memory/buffer limit somewhere but I'm not sure which one. According to nvidia-smi the GPU memory (12GB) is nowhere near depletion when running this.
What is the theoretical maximum resolution for webgl and what is it dependent on?
gl.getError()- gman