BlazorExtensions / Canvas

HTML5 Canvas API implementation for Microsoft Blazor
MIT License
614 stars 146 forks source link

Is there a plan to support WebGL2 ? (and bug provide) #89

Open MikiraSora opened 4 years ago

MikiraSora commented 4 years ago

Currently browsers and their plaform support webgl2 , but Canvas only support WebGL1 , even there is no way to use webgl extensions. So I wanna know question that the title said.

BTW , I also fork Canvas and try to implements WebGL2Context by inhert WebGLContext. There is my fork repo But I got "Uncaught TypeError: Illegal invocation” in runtime. I think webg2 support will be done quickly if this problem could fix image ref code image

PuerNoctis commented 3 years ago

I wanted to make the WebGL2 context available and got the same issue after getting a 'webgl2' context instead of 'webgl'.

The fix for me was to use the WebGL2RenderingContext instead of WebGLRenderingContext (mind the 'WebGL2*' there) in CanvasContextManager.ts.

This also required me to install the webgl2 types (npm install --save @types/webgl2) in the JS project.

After that, I was able to use the WebGL2 context and compile ES3.0 shaders.