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