Creates a WebGL context without a window for headless rendering and server-side graphics
Overall
score
96%
Build a server-side image processing utility that performs GPU-accelerated operations without requiring a display or browser environment.
Create a module that:
Implement a function clearToColor(r, g, b, a) that:
Implement a function getPixelAt(x, y) that:
cleanup() function that properly releases all GPU resources@generates
/**
* Clears the rendering buffer to the specified color.
*
* @param {number} r - Red component (0.0 to 1.0)
* @param {number} g - Green component (0.0 to 1.0)
* @param {number} b - Blue component (0.0 to 1.0)
* @param {number} a - Alpha component (0.0 to 1.0)
* @returns {Uint8Array} Pixel data in RGBA format
*/
function clearToColor(r, g, b, a) {
// IMPLEMENTATION HERE
}
/**
* Reads a single pixel at the specified coordinates.
*
* @param {number} x - X coordinate
* @param {number} y - Y coordinate
* @returns {number[]} Array of [r, g, b, a] values (0-255 range)
*/
function getPixelAt(x, y) {
// IMPLEMENTATION HERE
}
/**
* Releases all GPU resources.
*/
function cleanup() {
// IMPLEMENTATION HERE
}
module.exports = {
clearToColor,
getPixelAt,
cleanup
};Provides hardware-accelerated graphics rendering capabilities for Node.js environments.
Install with Tessl CLI
npx tessl i tessl/npm-gldocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10