Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

GLTFLoader ImageBitmapLoader overrides loaders for types it can't handle #19734

Closed
4 of 13 tasks
JohannesDeml opened this issue Jun 25, 2020 · 3 comments · Fixed by #19738
Closed
4 of 13 tasks

GLTFLoader ImageBitmapLoader overrides loaders for types it can't handle #19734

JohannesDeml opened this issue Jun 25, 2020 · 3 comments · Fixed by #19738

Comments

@JohannesDeml
Copy link
Contributor

Description of the problem

Due to the recently added usage of BitmapLoader in GLFTLoader (#19518), using handlers for specific file formats will be overwritten from the BitmapLoader.

In r117 to support basis textures for gltf files you would just need to add

var basisLoader = new BasisTextureLoader();
basisLoader.setTranscoderPath( 'js/libs/basis/' );
basisLoader.detectSupport( renderer );
THREE.DefaultLoadingManager.addHandler( /\.basis$/, basisLoader );

This is not possible anymore, since the resolve will be overwritten here:

return new Promise( function ( resolve, reject ) {
var onLoad = resolve;
if ( useImageBitmap ) {
onLoad = function ( imageBitmap ) {
resolve( new CanvasTexture( imageBitmap ) );
};
}
loader.load( resolveURL( sourceURI, options.path ), onLoad, undefined, reject );
} );

I'm getting the following error:

THREE.WebGLState: TypeError: Failed to execute 'texImage2D' on 'WebGL2RenderingContext': No function was found that matched the signature provided.
    at Object.texImage2D (three.module.js:21828)
    at uploadTexture (three.module.js:22749)
    at setTexture2D (three.module.js:22274)
    at WebGLTextures.safeSetTexture2D (three.module.js:23169)
    at SingleUniform.setValueT1 [as setValue] (three.module.js:17755)
    at Function.WebGLUniforms.upload (three.module.js:18260)
    at setProgram (three.module.js:26406)
    at WebGLRenderer.renderBufferDirect (three.module.js:25441)
    at renderObject (three.module.js:25994)
    at renderObjects (three.module.js:25966)
Three.js version
  • Dev
  • r118
  • r117
Browser
  • All of them
  • Chrome
  • Firefox
  • Edge
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, ...)
@JohannesDeml JohannesDeml changed the title GLTFLoader tries to use ImageBitmapLoader for .basis textures GLTFLoader ImageBitmapLoader overrides loaders for types it can't handle Jun 25, 2020
@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 26, 2020

Same error occurs with one of the official examples when using the glTF-dds extension:

https://threejs.org/examples/webgl_loader_gltf_extensions

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 26, 2020

@JohannesDeml Can you please check if the linked PR solves your issue? At least I could fix the DDS example with it^^.

@JohannesDeml
Copy link
Contributor Author

@Mugen87 Yes, that does fix the problem for me. Thanks a lot taking care of the bug so fast!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants