copyFramebufferToTexture method

void copyFramebufferToTexture(
  1. dynamic position,
  2. Texture texture, {
  3. int level = 0,
})

Implementation

void copyFramebufferToTexture(position, Texture texture, {int level = 0}) {
  if (texture is! FramebufferTexture) {
    print(
        'THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.');
    return;
  }

  var levelScale = Math.pow(2, -level);
  var width = Math.floor(texture.image.width * levelScale);
  var height = Math.floor(texture.image.height * levelScale);

  textures.setTexture2D(texture, 0);

  _gl.copyTexSubImage2D(
      _gl.TEXTURE_2D, level, 0, 0, position.x, position.y, width, height);

  state.unbindTexture();
}