Microsoft/TypeScript

texSubImage2D missing WebGL2 syntax

Open

#58 695 ouverte le 29 mai 2024

Voir sur GitHub
 (0 commentaires) (0 réactions) (0 assignés)TypeScript (6 726 forks)batch import
BugDomain: lib.d.tsHelp Wanted

Métriques du dépôt

Stars
 (48 455 stars)
Métriques de merge PR
 (Merge moyen 6j 17h) (9 PRs mergées en 30 j)

Description

🔎 Search Terms

texSubImage2D WebGL2

🕗 Version & Regression Information

  • I was unable to test this on prior versions because I used gl.texSubImage2D with ImageBitmap as 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

Guide contributeur