Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2811,9 +2811,15 @@ class WebGLRenderer {

} else if ( isRenderTarget3D ) {

const textureProperties = properties.get( renderTarget.texture );
const layer = activeCubeFace;
_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel, layer );

for ( let i = 0; i < renderTarget.textures.length; i ++ ) {

const textureProperties = properties.get( renderTarget.textures[ i ] );

_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, textureProperties.__webglTexture, activeMipmapLevel, layer );

}

} else if ( renderTarget !== null && activeMipmapLevel !== 0 ) {

Expand Down
20 changes: 14 additions & 6 deletions src/renderers/webgl/WebGLTextures.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,

const textureProperties = properties.get( texture );

if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {

uploadTexture( textureProperties, texture, slot );
return;
Expand All @@ -559,7 +559,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,

const textureProperties = properties.get( texture );

if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {

uploadTexture( textureProperties, texture, slot );
return;
Expand Down Expand Up @@ -2002,13 +2002,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
const attachment = textures[ i ];
const attachmentProperties = properties.get( attachment );

state.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );
setTextureParameters( _gl.TEXTURE_2D, attachment );
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );
let glTextureType = _gl.TEXTURE_2D;

if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {

glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;

}

state.bindTexture( glTextureType, attachmentProperties.__webglTexture );
setTextureParameters( glTextureType, attachment );
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, glTextureType, 0 );

if ( textureNeedsGenerateMipmaps( attachment ) ) {

generateMipmap( _gl.TEXTURE_2D );
generateMipmap( glTextureType );

}

Expand Down