Microsoft/TypeScript

texSubImage2D missing WebGL2 syntax

Open

#58,695 创建于 2024年5月29日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)TypeScript (6,726 fork)batch import
BugDomain: lib.d.tsHelp Wanted

仓库指标

Star
 (48,455 star)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 9 个 PR)

描述

🔎 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

贡献者指南