Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Inconsistent texture binding + account for depth in generateMipMap #22067

Closed
mbredif opened this issue Jun 30, 2021 · 0 comments · Fixed by #22072
Closed

Inconsistent texture binding + account for depth in generateMipMap #22067

mbredif opened this issue Jun 30, 2021 · 0 comments · Fixed by #22072
Labels

Comments

@mbredif
Copy link
Contributor

mbredif commented Jun 30, 2021

Problem:

  • glTextureType is bound and set up.
  • _gl.TEXTURE_2D is used for mipmap generation and unbound.
    however glTextureType may not be _gl.TEXTURE_2D

state.bindTexture( glTextureType, textureProperties.__webglTexture );
setTextureParameters( glTextureType, texture, supportsMips );
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType );
if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
generateMipmap( _gl.TEXTURE_2D, texture, renderTarget.width, renderTarget.height );
}
state.bindTexture( _gl.TEXTURE_2D, null );

fix :

  • use glTextureType instead of _gl.TEXTURE_2D
  • adapt generateMipMap to take depth into account

textureProperties.__maxMipLevel = Math.log2( Math.max( width, height ) );

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants