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

Failed to execute 'shaderSource' on 'WebGL2RenderingContext': parameter 1 is not of type 'WebGLShader'. #63

Open
Akash952112 opened this issue Mar 22, 2023 · 1 comment
Assignees
Labels
📦 React ❓ Question Asking question about @egjs/view3d

Comments

@Akash952112
Copy link

Akash952112 commented Mar 22, 2023

I am getting this error in my mobile device while rendering component.

Uncaught (in promise) TypeError: Failed to execute 'shaderSource' on 'WebGL2RenderingContext': parameter 1 is not of type 'WebGLShader'.

with this warning
WARNING: Too many active WebGL contexts. Oldest context will be lost.

It works fine on my PC but gives this error on mobile devices.

previously I was using "@egjs/react-view3d": "^2.1.0", this version then I upgrade it to "@egjs/react-view3d": "^2.3.1" this latest
version but it still gives an error

@WoodNeck
Copy link
Member

WoodNeck commented Mar 22, 2023

Hello @Akash952112,
Like the error message says, there's a limit to the maximum number of WebGL contexts that can be created.
I'm wondering if the page you've created is beyond those limitations.
I think the number was between 8 to 16 on mobile devices.

It's a browser restriction. so if you have too many components using WebGL on your page, try removing some.

Or, you can try showing View3D / or other WebGL components only when visible.
This can be done with IntersectionObserver. You just have to call init when visible and destroy when not visible.

If you're using a single View3D instance only, then this is clearly a bug of View3D.
In this case, please give me some hints(JS framework you're using, rendering code, etc...) to reproduce this issue and then I'll fix it.

@WoodNeck WoodNeck self-assigned this Mar 22, 2023
@WoodNeck WoodNeck added ❓ Question Asking question about @egjs/view3d 📦 React labels Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 React ❓ Question Asking question about @egjs/view3d
2 participants