Failed to execute 'texImage2D' on 'WebGLRenderingContext': No function was found that matched the signature provided

I’m using ionic 3 framework to build an Android and Electron Application.

Now I’ve to add Three.js (the version in use is the r110) in the app and I have no experience in WebGL nor three.js.

When I run the application with Electron all seems fine, but when I run the app in an android emulator with Android API 28 this error happens “Failed to execute ‘texImage2D’ on ‘WebGLRenderingContext’: No function was found that matched the signature provided.”

I think the problem is that the version of chrome used by Android is “Chrome/69.0.3497.100”, while in Electron is “Chrome/76.0.3809.146”.

This is the part of code that use the texImage2D function

private loadCollada() {
    const loader = new ColladaLoader();
    loader.load('assets/edo/model/model.dae', (collada) => {
      this.dae = collada.scene;
      this.dae.scale.x = this.dae.scale.y = this.dae.scale.z = 1;
      this.dae.updateMatrix();
      this.scene.add(this.dae);
    });
  }

I found in three.js library that the error is logged in three.module.js

function texImage2D() {

    try {

        gl.texImage2D.apply( gl, arguments );

    } catch ( error ) {

        console.error( 'THREE.WebGLState:', error );

    }

}

I don’t know if it might be useful but I have also this message in my console printed so many times.

[.WebGL-0xcba04400]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering. [file:///android_asset/www/index.html]

There is a workaround or a way to fix this problem?

I don’t think that’s likely to be the problem.

Can you run a much simpler three.js app in the emulator? Don’t load any textures or models, just get a simple cube to display.

This is the part of code that use the texImage2D function

Can you share the entire code? It’s hard to debug a problem from a tiny code snippet.

Sorry.
i took the code from this repository GitHub - JohnnyDevNull/ng-three-template: This is a basic template project to start with Angular 16.x and ThreeJS the difference is that in the repository the app executes a cube instead of a collada model

I ran the the app with only the cube and no errors are shown.

It seems that when I load the collada model, also a .png file is loaded, I’ve also read in this post 'texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering · Issue #6014 · pixijs/pixijs · GitHub

My collada model load a huge .png file (7022x7022) I scaled the image to 2048x2048 but the error is still here.

any workaround on this?

been getting the same issue, my electron three.js app runs fine but i get these errors also running old version of three.js for various reasons.

would be nice to kill the errors though so if anyone has a fix please drop it in the comments :slight_smile:

Avoid using old versions of threejs, and make sure your textures are scaled to a power of 2, 32,64,128,256,512,1024,2048

Try replacing all your textures in materials with a single texture of 128x128 and see if the error stops…