BlazorExtensions / Canvas

HTML5 Canvas API implementation for Microsoft Blazor
MIT License
620 stars 144 forks source link

Fixed missing "border" parameter in TexImage2D & TexImage2DAsync (WebGLContext) #60

Open MrTP opened 4 years ago

MrTP commented 4 years ago

Fixes Issue https://github.com/BlazorExtensions/Canvas/issues/50 The current implementation of texImage2D throws an exception on call because its missing the "border" parameter. Since border is specified to always be 0 it could be set by default but I did not want to deviate from the parameter count used in standard WebGL.

2ndwolf commented 4 years ago

I'm getting WASM: Microsoft.JSInterop.JSException: Failed to execute 'texImage2D' on 'WebGLRenderingContext': parameter 9 is not of type 'ArrayBufferView'.

Now from using your branch, even though I'm using byte[] in parameter 9. Tried float[] but it gives me a webgl error instead.

Using an int[] instead of byte and changing line 94 of CanvasContextManager.ts to returning an Uint8Array solved it. But using an int takes up memory. Trying to make the typescript file output an ArrayBufferView but haven't succeded yet.

thomas-mathers commented 4 years ago

could someone please merge this already?

jefflomax commented 3 years ago

2ndwolf : In my case, I was using a byte[] for the data, which was passed as a string to CompanyContextManager.ts deserialize. I added else if (typeof (object) === "string" && (method === "bufferData" || method === "bufferSubData" || method === "texImage2D")) { and that got past that issue, still working thru other rendering setup.

BenMakesGames commented 3 years ago

I'm experiencing the same issue as @2ndwolf. I would also really like this missing parameter issue sorted, but I think more work is needed than what's in this PR.