Creates a WebGL context without a window for headless rendering and server-side graphics
Overall
score
96%
Build a utility that creates WebGL contexts with different configurations for rendering pipelines with varying requirements.
Your utility should provide a function that creates WebGL contexts with customizable attributes based on different rendering scenarios.
Create a function createConfiguredContext(width, height, config) that:
Support the following configuration profiles:
High Quality Rendering
Performance Mode
2D Canvas Mode
Persistent Buffer Mode
@generates
/**
* Creates a WebGL context with specified configuration attributes.
*
* @param {number} width - Drawing buffer width in pixels
* @param {number} height - Drawing buffer height in pixels
* @param {Object} config - Configuration object with context attributes
* @param {boolean} [config.alpha] - Enable alpha channel
* @param {boolean} [config.depth] - Enable depth buffer
* @param {boolean} [config.stencil] - Enable stencil buffer
* @param {boolean} [config.antialias] - Enable antialiasing
* @param {boolean} [config.preserveDrawingBuffer] - Preserve buffer between frames
* @returns {WebGLRenderingContext} Configured WebGL context
*/
function createConfiguredContext(width, height, config) {
// IMPLEMENTATION HERE
}
module.exports = { createConfiguredContext };Provides headless WebGL context creation with configurable attributes.
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