1265 Commits

Author SHA1 Message Date
Gregg Tavares
67551111b4 Fix CSS
There was a time when 100vh was correct but mobile browsers changed.
2025-10-13 14:54:12 -07:00
Gregg Tavares
bf44f7ac0a add stencil example 2025-10-13 00:22:08 -07:00
Gregg Tavares
07e932d04a build v7.0.0 2025-07-15 23:22:47 -07:00
Gregg Tavares
a7706f608c bump to v7.0.0 2025-07-15 23:17:36 -07:00
Gregg Tavares
2b0e1daeb1 Support uploading multiple mip levels
This only works for passing arrays. It assumes you pass
however much data is needed for mips up to the level you
want uploaded. In other words. Say your texture is 10x7 RGBA.
Then src would be a TypedArray with 10x7 + 5x3 + 2x1 + 1x1
4 byte texels or exactly 352 bytes.

If you pass (10x7 + 5x3) * 4, which is 340 bytes, then it would
only fill out the first 2 mip levels. That texture would be
unrenderable unless you (1) set filtering to not use mips or
(2) set `maxLevel` to 1 (TEXTURE_MAX_LEVEL).
2025-07-15 23:15:58 -07:00
Gregg Tavares
f01d97501d build v6.2.0 2025-07-11 21:36:50 -07:00
Gregg Tavares
211d0f78c7 bump to v6.2.0 2025-07-11 21:36:29 -07:00
Gregg Tavares
0128db9cb4 More compressed texture cleanup
* fix colorRenderable, textureFilterable data

  All compressed texture formats are textureFilterable but not
  colorRenderable.

* Support cubemaps

  This code got simpilied. We require the src to by the exact size.
  so we can get the size of a face just by dividing by 6. No need
  for the extra math. This works for both compressed and normal
  textures.

  Added a test
2025-07-11 21:33:05 -07:00
Gregg Tavares
8f53aa82a9 Fix issues with compressed texture support
* Get rid of the compression option

  We know if a texture is compressed based on its internalFormat

* Remove level stuff

  I think there was a mis-understanding how how twgl works. If you
  want to set anything other than level 0 you need to directly
  call `setTextureFormArray` directly (or `setTextureFromElement`)

* Fix tests

  The tests needed to check that the extension exists

Note: we need to decide if and how to handle cubemaps.
The code in their currently will fail. Will fix in next PR
2025-07-11 20:21:23 -07:00
krapnik
3a4c8809fb -add ext WEBGL_compressed_texture_etc 2025-07-12 04:30:35 +08:00
krapnik
e5bf81d26c - update webgl constants
- Optimize the calling parameters of `compressedTexImage2D`
- add `test compressed texture format`
2025-07-12 04:24:03 +08:00
krapnik
f5c1c9442f fix typo 2025-07-11 14:35:13 +08:00
krapnik
48f76d434e Support for compressed texture formats 2025-07-11 14:29:26 +08:00
Gregg Tavares
2f8b587c2f build v6.1.1 2025-04-27 10:21:19 +09:00
Gregg Tavares
85a8765e0c changelist 2025-04-27 10:20:29 +09:00
Gregg Tavares
592b9e8112 test it does not delete existing shaders
fix async tests
2025-04-27 10:20:02 +09:00
Gregg Tavares
8e3447fb67 fix createProgram for getting passed WebGLShaders 2025-04-27 09:06:49 +09:00
Gregg Tavares
e9624559ab update docs 2025-04-27 09:06:49 +09:00
Gregg Tavares
941d482b3d build 2024-11-18 10:23:14 -08:00
Gregg Tavares
4a9038e76a fix toc background mobile 2024-11-18 10:23:14 -08:00
Gregg Tavares
15a0b487ac skip webgl2-texturess as its timing out??? 2024-11-18 10:23:14 -08:00
Gregg Tavares
8d34a619c5 try use metal 2024-11-18 10:23:14 -08:00
Gregg Tavares
206eb721d1 add more info and use ignore-gpu-blacklist 2024-11-18 10:23:14 -08:00
Gregg Tavares
5f26a88407 remove ignore-block-list 2024-11-18 10:23:14 -08:00
Gregg Tavares
64c6cd8c77 skip dynamic-buffers.html because it timesout 2024-11-18 10:23:14 -08:00
Gregg Tavares
702ed2484f add network idle timeout 2024-11-18 10:23:14 -08:00
Gregg Tavares
3945a2d35e cleanup injected js 2024-11-18 10:23:14 -08:00
Gregg Tavares
33333e3f67 try ignore-gpu-blocklist 2024-11-18 10:23:14 -08:00
Gregg Tavares
2ed2de7d87 add gpu info 2024-11-18 10:23:14 -08:00
Gregg Tavares
3aeba35c17 use macos for test 2024-11-18 10:23:14 -08:00
Gregg Tavares
8b4505cf0f add screenshots to build 2024-11-18 10:23:14 -08:00
Gregg Tavares
b04426a320 fix test v6.1.0 2024-09-07 19:30:03 -07:00
Gregg Tavares
25f6e5179d build 2024-09-07 19:18:02 -07:00
Gregg Tavares
9ccb1c82cb bump to v6.1.0 2024-09-07 19:16:37 -07:00
Gregg Tavares
106b7cf0b9 Add createTextureAsync and createTexturesAsync
I'm not really sure I should add these. I think I thought
about it before.

The issue is, createTexture and createTextures both return
usable textures immediately. No waiting. If the data for the
texture needs to be loaded asynchronously, they'll return a 1x1
pixel texture. createTextureAsync and createTexturesAsync on the
other hand, only return the texture after their async sources
have loaded.

These are more here for completeness as sometimes you actually
do want to wait until the texture's data is loaded and it's now
common to use promises for this purpose.
2024-09-07 19:11:07 -07:00
Gregg Tavares
364ddd621e build v6.0.1 2024-09-07 18:52:58 -07:00
Gregg Tavares
4ebb8b94b0 bump to v6.0.1 2024-09-07 18:52:29 -07:00
Gregg Tavares
46355ae1d5 Handle the case of async loading and the user changing
the pack state.

Before

    const t = twgl.createTexture({src: 'https://some/img.jpg'});
    gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
    // t is flipped

After

    const t = twgl.createTexture({src: 'https://some/img.jpg'});
    gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
    // t is not flipped
2024-09-07 18:49:41 -07:00
Gregg Tavares
eaa4b13df8 build v6.0.0 2024-09-07 10:32:54 -07:00
Gregg Tavares
f95b9def52 dist/5.x -> dist/6.x 2024-09-07 10:30:19 -07:00
Gregg Tavares
ff06f0e8c4 bump to v6.0.0 2024-09-07 10:27:52 -07:00
Gregg Tavares
90785fc626 CHANGELIST 2024-09-07 10:25:47 -07:00
Gregg Tavares
cceaa19c47 Fix pixel store issues
Internal change. `gl.pixelStorei` state for `UNPACK_COLORSPACE_CONVERSION_WEBGL`
`UNPACK_PREMULTIPLY_ALPHA_WEBGL` and `UNPACK_FLIP_Y_WEBGL`
is now saved and restored as the previous behavior had a race condition.

Before

```js
t1 = twgl.createTexture(gl, {src: 'https://p.com/slow.jpg'});  // may or may not be flipped!!!!
t2 = twgl.createTexture(gl, {src: 'https://p.com/fast.jpg', flipY: true });  // flipped
```

In the example above, whether or not `t1` is flipped was unknown
since if `t2` loads first, it would be flipped. If `t1` loads first
it would not be flipped.

The fix is to save and restore the `pixelStorei` state for each texture.

Unfortunately, this is a breaking change.

Before

```js
twgl.createTexture(gl, {src: someImageElem1, flipY: true });  // flipped
twgl.createTexture(gl, {src: someImageElem2 });               // also flipped
```

after

```js
twgl.createTexture(gl, {src: someImage, flipY: true });  // flipped
twgl.createTexture(gl, {src: someImage });               // NOT flipped
```

Note: in all versions the behavior was and still is, that if you set
the `pixelStorei` parameters outside they applied.

```js
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true)
twgl.createTexture(gl, {src: someImage });  // flipped
twgl.createTexture(gl, {src: someImage });  // flipped
```
2024-09-07 10:24:54 -07:00
Gregg Tavares
a662680d37 switch to main 2024-07-14 16:33:10 -07:00
Gregg Tavares
080ee318fb update test action 2024-06-26 20:46:59 -07:00
Gregg Tavares
d5462396d3 build v5.6.0 2024-06-26 18:06:56 -07:00
Gregg Tavares
b271e9648b bump to v5.6.0 2024-06-26 18:06:16 -07:00
Gregg Tavares
f7a408219d Add support for a shared buffer and offsets for uniform buffers
This works but I wrote a sample and it ran really slow. Like
I couldn't even draw 6 cubes

Not sure why but don't want to merge a solution until it's fast
2024-06-26 18:03:43 -07:00
Gregg Tavares
b542585f8a bump to newer js 2024-06-18 15:10:39 -07:00
Gregg Tavares
80edde4e1a build v5.5.4 2024-02-28 13:49:49 -08:00