CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-gl

Creates a WebGL context without a window for headless rendering and server-side graphics

Overall
score

96%

Overview
Eval results
Files

task.mdevals/scenario-10/

Texture Filter Manager

A utility for managing texture sampling configurations in WebGL 2, allowing dynamic switching between different filtering modes without modifying texture parameters.

Capabilities

Sampler Creation

  • Creates a sampler object and configures it with NEAREST filtering for both minification and magnification @test
  • Creates a sampler object with LINEAR filtering and CLAMP_TO_EDGE wrapping @test

Sampler Binding

  • Binds a sampler to texture unit 0 and verifies it affects texture sampling @test
  • Binds different samplers to multiple texture units simultaneously @test

Sampler Parameter Management

  • Sets sampler minification filter to NEAREST and magnification filter to LINEAR @test
  • Configures sampler wrap modes for S and T coordinates independently @test

Implementation

@generates

API

/**
 * Creates and configures a sampler object with specified filtering parameters.
 *
 * @param {WebGL2RenderingContext} gl - The WebGL 2 rendering context.
 * @param {Object} options - Configuration options for the sampler.
 * @param {number} options.minFilter - Minification filter (e.g., gl.NEAREST, gl.LINEAR).
 * @param {number} options.magFilter - Magnification filter (e.g., gl.NEAREST, gl.LINEAR).
 * @param {number} [options.wrapS] - S-coordinate wrapping mode (default: gl.CLAMP_TO_EDGE).
 * @param {number} [options.wrapT] - T-coordinate wrapping mode (default: gl.CLAMP_TO_EDGE).
 * @returns {WebGLSampler} The created sampler object.
 */
function createSampler(gl, options) {
  // IMPLEMENTATION HERE
}

/**
 * Binds a sampler object to a specified texture unit.
 *
 * @param {WebGL2RenderingContext} gl - The WebGL 2 rendering context.
 * @param {number} unit - The texture unit index (0-based).
 * @param {WebGLSampler} sampler - The sampler object to bind.
 */
function bindSampler(gl, unit, sampler) {
  // IMPLEMENTATION HERE
}

/**
 * Updates a sampler's filtering parameters.
 *
 * @param {WebGL2RenderingContext} gl - The WebGL 2 rendering context.
 * @param {WebGLSampler} sampler - The sampler object to update.
 * @param {number} minFilter - New minification filter.
 * @param {number} magFilter - New magnification filter.
 */
function updateSamplerFilters(gl, sampler, minFilter, magFilter) {
  // IMPLEMENTATION HERE
}

/**
 * Deletes a sampler object and releases its resources.
 *
 * @param {WebGL2RenderingContext} gl - The WebGL 2 rendering context.
 * @param {WebGLSampler} sampler - The sampler object to delete.
 */
function deleteSampler(gl, sampler) {
  // IMPLEMENTATION HERE
}

module.exports = {
  createSampler,
  bindSampler,
  updateSamplerFilters,
  deleteSampler,
};

Dependencies { .dependencies }

gl { .dependency }

Provides headless WebGL 2 rendering context for server-side graphics operations.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-gl

tile.json