[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] color buffer (half) float

On Mon, Jun 23, 2014 at 7:51 PM, Kenneth Russell <kbr@google.com> wrote:
Yes. There is a significant technical issue with implementing
WEBGL_color_buffer_float on top of OpenGL ES 2.0, which is that there
is no ES 2.0 extension defining the behavior of color_buffer_float.
That shouldn't matter really. On platforms that define no queryable extension/capability for the permissability to attach a floating point texture to a framebuffer, a straightforward test by the browser can be performed by simply checking if it works:

1) Create a floating point texture (if there isn't one, it can't work anyway)
2) Create a byte texture
3) Create a framebuffer and attach the floating point texture
4) check for errors and framebuffer completeness, if error or incomplete, it can't work.
5) fill the floating point texture with a simple shader
6) bind the floating point texture as a sampler
7) attach the byte texture to another framebuffer
8) render the contents of the floating point texture to the byte texture
9) readPixels on the byte texture
10) if the values are as expected, floating point texture framebuffers work -> enable the extension, if not, don't enable it.

I implement that in JS to emulate that extension. Helps a great deal in picking renderingpaths and prevent undue "black screens". Would be nice if that snippet wasn't required to be included by everybody, but I ain't crying if browsers can't agree on how to provide 20 lines of utility code.