MCPcopy
hub / github.com/KilledByAPixel/LittleJS / glSetTexture

Function glSetTexture

src/engineWebGL.js:312–320  ·  view source on GitHub ↗

Set the WebGL texture, called automatically if using multiple textures * - This may also flush the gl buffer resulting in more draw calls and worse performance * @param {WebGLTexture} texture * @memberof WebGL

(texture)

Source from the content-addressed store, hash-verified

310 * @param {WebGLTexture} texture
311 * @memberof WebGL */
312function glSetTexture(texture)
313{
314 // must flush cache with the old texture to set a new one
315 if (!glContext || texture === glActiveTexture) return;
316
317 glFlush();
318 glActiveTexture = texture;
319 glContext.bindTexture(glContext.TEXTURE_2D, glActiveTexture);
320}
321
322/** Set the wrap mode (REPEAT or CLAMP_TO_EDGE) on an existing WebGL texture
323 * Flushes the current batch only if the texture is the active one

Callers 2

drawTileFunction · 0.85
drawTextureWrappedFunction · 0.85

Calls 1

glFlushFunction · 0.85

Tested by

no test coverage detected