PDA

View Full Version : Floating point textures?



enot
06-29-2010, 06:06 AM
For GPU based simulations (e.g. solving equations with partial derivatives on GPU) one could store (and render) floating point data in textures. In core OpenGL ES 2.0, there are ratified extensions GL_OES_texture_half_float and GL_OES_texture_float.
In FireFox I can use gl.FLOAT data in gl.texImage2D()
gl.texImage2D(gl.TEXTURE_2D, 0, gl.ALPHA, tSize, tSize, 0, gl.ALPHA, gl.FLOAT, new WebGLFloatArray(pixels));
http://www.ibiblio.org/e-notes/webgl/tex_float.html
but with 8-bit limited precision (i.e. 1/512 is passed as 0)
http://www.ibiblio.org/e-notes/webgl/tex_float0.html
How can I use 32 bit floating point textures in WebGL?

giles
07-01-2010, 08:19 AM
As far as I understand it, they're not working right now. A lot of the shadow map implementations I've seen have worked around this by basically doing their own conversion from floats to 4-byte words and stuffing them in the RGBA channels.

gregg
09-16-2010, 02:53 PM
Floating point textures are not part of WebGL 1.0 as they are not part of OpenGL ES 2.0 which WebGL is based on.

But don't get too disappointed. They'll likely be added as an extension soon after 1.0 ships.

giles
12-22-2010, 02:26 PM
Floating point textures are not part of WebGL 1.0 as they are not part of OpenGL ES 2.0 which WebGL is based on.

But don't get too disappointed. They'll likely be added as an extension soon after 1.0 ships.

Thanks, gregg -- looks like they've been added now (https://www.khronos.org/webgl/public-mailing-list/archives/1012/msg00062.html), and they're reported to work in Chromium nightlies.

SteveBaker
12-23-2010, 06:13 AM
I think there are still some remaining issues with float textures - they may be available, but not necessarily something you can render into.