pex-context icon indicating copy to clipboard operation
pex-context copied to clipboard

ctx.PixelFormat.RGBA32F is not renderable in WebGL2?

Open vorg opened this issue 3 years ago • 7 comments

Can't make any rg.* node work with pixelFormat: ctx.PixelFormat.RGBA32F. I get empty texture. ctx.PixelFormat.RGBA16F works fine. Tried both Linear and Nearest filtering.

Not needed (i can change older r.g. node to use 16F) but i wonder why is that?

vorg avatar Jun 17 '22 10:06 vorg

You need to enable EXT_color_buffer_float: https://developer.mozilla.org/en-US/docs/Web/API/EXT_color_buffer_float

https://github.com/pex-gl/pex-renderer/blob/f642330f86157dd7169843f44482a5b0b634124b/index.js#L82-L85

dmnsgn avatar Jun 17 '22 10:06 dmnsgn

Oh that's so confusing because EXT_color_buffer_float seems to be handling both 32F and 16F. Fine.

vorg avatar Jun 17 '22 11:06 vorg

Should we add this as in ctx.capabilities?

dmnsgn avatar Dec 02 '22 10:12 dmnsgn

Yes

vorg avatar Dec 02 '22 10:12 vorg

FYI, the list of renderable formats is long: https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/renderbufferStorage

So I removed the check in renderBuffer (b736415) but if you prefer I can do a big [...renderableFormats].includes(renderbuffer.pixelFormat) instead.

dmnsgn avatar Dec 02 '22 11:12 dmnsgn

FYI, the list of renderable formats is long:

And we have not, are not and will not use them. I would prefer go back to top 10 used and add more if ever needed (i doubt it).

vorg avatar Dec 02 '22 13:12 vorg

b41b2bde10789c2ea785c233da3469a382efa13e actually broke support for WebGL1 float texture2D as I am overriding gl.RGBA16F and gl.RGBA32F with ext.RGBA32F_EXT and this is not how it should work for texture: these should only be used in renderbuffer.

Fixed in 588bfedde7e9515e79e005bec9798731d52913a0 with added test

dmnsgn avatar Jan 13 '23 14:01 dmnsgn