You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionwebGLTextureFromImageUrl(gl,url,loadedCallback){constimgElement=newImage();// Creates an HTMLImageElementimgElement.addEventListener('load',()=>{consttexture=gl.createTexture();// Create a WebGL Texturegl.bindTexture(gl.TEXTURE_2D,texture);gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,gl.RGBA,gl.UNSIGNED_BYTE,imgElement);gl.generateMipmap(gl.TEXTURE_2D);loadedCallback(texture);});imgElement.src=url;}
* fix: make pick async to support impl in WebGPU (#1398)
* fix: skip loading Box2D if it's already existed #1393
* fix: update latest physx
* fix: support 2 kinds of clip z range #863
* fix: make pick async to support impl in WebGPU #1400
* fix: use async readpixels in webgl2
* fix: use premultiplied alpha in WebGL & WebGPU #1399
* fix: use createImageBitmap to create texture if possible #1401
* chore: add test case for ssr with g-webgl
* chore: adjust examples of performance block (#1402)
* chore: adjust examples of performance block
* fix: reset transform with keyword none
* chore: add ga4 key
* fix: createImageBitmap should account for error of SVG failure
* fix: avoid overriding defXY when parsing path (#1405)
* fix: avoid overriding defXY when parsing path #1404
* chore: commit changeset
* chore(release): bump version (#1403)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
参考:https://toji.dev/webgpu-best-practices/img-textures
在 WebGL 中加载 Image 用法如下:
因此需要实现 Device 中 Texture 的 setSubData 方法。
首先需要使用 https://developer.mozilla.org/en-US/docs/Web/API/createImageBitmap 创建 ImageBitmap,这是一个异步方法。
The text was updated successfully, but these errors were encountered: