microsoft / microsoft/TypeScript
texSubImage2D missing WebGL2 syntax
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔎 Search Terms
texSubImage2D WebGL2
🕗 Version & Regression Information
- I was unable to test this on prior versions because I used
gl.texSubImage2DwithImageBitmapas source only just now
⏯ Playground Link
No response
💻 Code
gl.texSubImage2D(
gl.TEXTURE_2D,
0,
0,
0,
100,
100,
gl.RGBA,
gl.UNSIGNED_BYTE,
data // <----- instanceof ImageBitmap
);
🙁 Actual behavior
Error:
Argument of type 'ImageBitmap' is not assignable to parameter of type 'ArrayBufferView'.
Type 'ImageBitmap' is missing the following properties from type 'ArrayBufferView': buffer, byteLength, byteOffset
🙂 Expected behavior
The code actually works fine, but I expect TS to not complain about the type.
Additional information about the issue
I am using a worker to gradually create the texture by creating the tiles and sending them back. The data comes from createImageBitmap metod as ImageBitmap and then pass it to texSubImage2D
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by searching the WebGL2 texSubImage2D declarations, using the reported call signature and ImageBitmap error as the entry point. Compare the available overloads with the WebGL2 syntax and verify that this exact ImageBitmap call type-checks without breaking the existing ArrayBufferView form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100