setTexture2D method
Implementation
void setTexture2D(Texture texture, int slot) {
final textureProperties = properties.get(texture);
if (texture is VideoTexture) updateVideoTexture(texture);
if (texture is OpenGLTexture) {
uploadOpenGLTexture(textureProperties, texture, slot);
return;
}
if (texture.version > 0 && textureProperties["__version"] != texture.version) {
final image = texture.image;
if (texture is! OpenGLTexture && image == null) {
console.warning('WebGLRenderer: Texture marked for update but image is null');
}
else if (texture is! OpenGLTexture && image.complete == false) {
console.warning('WebGLRenderer: Texture marked for update but image is incomplete');
}
else {
uploadTexture(textureProperties, texture, slot);
return;
}
}
state.activeTexture(WebGL.TEXTURE0 + slot);
state.bindTexture(WebGL.TEXTURE_2D, textureProperties["__webglTexture"]);
}