Skip to content

WebGLRenderer: Allow for copying data between render targets using "copyTextureToTexture" #29612

@gkjohnson

Description

@gkjohnson

Description

Currently when calling copyTextureToTexture with two render target textures you get the following warning. I'm not sure if this is a limitation of the underlying WebGL APIs or if this is possible to achieve if we change something about the function:

WebGL: INVALID_OPERATION: texSubImage2D: no bound PIXEL_UNPACK_BUFFER

Repro code:

import * as THREE from 'three';

const renderer = new THREE.WebGLRenderer( { antialias: true } );
const r1 = new THREE.WebGLRenderTarget( 100, 100 );
const r2 = new THREE.WebGLRenderTarget( 100, 100 );

renderer.initRenderTarget( r1 );
renderer.initRenderTarget( r2 );
renderer.copyTextureToTexture( r1.texture, r2.texture );

Solution

Adjust underlying function implementation to support copying data between render target textures for 2d and 3d textures.

Alternatives

Use a custom FullScreenPass method for copying data.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions