copyFramebufferToTexture method
void
copyFramebufferToTexture(
- dynamic position,
- Texture? texture, {
- int level = 0,
})
Implementation
void copyFramebufferToTexture(position, Texture? texture, {int level = 0}) {
//console.warning('copyFramebufferToTexture not supported');
if (texture is! FramebufferTexture) {
console.warning('WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.');
return;
}
final levelScale = math.pow(2, -level);
final width = (texture.image.width * levelScale).floor();
final height = (texture.image.height * levelScale).floor();
textures.setTexture2D(texture, 0);
_gl.copyTexSubImage2D(WebGL.TEXTURE_2D, level, 0, 0, position.x.toInt(), position.y.toInt(), width, height);
state.unbindTexture(WebGLTexture(WebGL.TEXTURE_2D));
}