bindTexture method
void
bindTexture(
- int webglType,
- WebGLTexture? webglTexture, [
- int? webglSlot
])
Implementation
void bindTexture(int webglType, WebGLTexture? webglTexture, [int? webglSlot]) {
if ( webglSlot == null ) {
if ( currentTextureSlot == null ) {
webglSlot = WebGL.TEXTURE0 + maxTextures - 1;
}
else {
webglSlot = currentTextureSlot;
}
}
BoundTexture? boundTexture = currentBoundTextures[webglSlot];
if (boundTexture == null) {
boundTexture = BoundTexture();
currentBoundTextures[webglSlot!] = boundTexture;
}
if (boundTexture.type != webglType || boundTexture.texture != webglTexture) {
if ( currentTextureSlot != webglSlot ) {
gl.activeTexture( webglSlot! );
currentTextureSlot = webglSlot;
}
gl.bindTexture(
webglType,
webglTexture ?? emptyTextures[webglType]
);
boundTexture.type = webglType;
boundTexture.texture = webglTexture;
}
}