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

Re: [Public WebGL] Restricting WebGL exposure of OES_depth_texture

On Tue, Jun 5, 2012 at 9:29 PM, Gregg Tavares (社用) <gman@google.com> wrote:
In trying to implement this I'm running into issues

#1) it looks like we'll need to restrict depth textures to level 0 only.

Reason: WebGL requires that we clear textures. Otherwise you could potential read uninitialized memory.
We can clear a depth texture by attaching to an FBO and calling glClear but we can only attach to level 0
in OpenGL ES 2.0 which means it's impossible to clear levels > 0.
I think that's fine, you can also only render to level 0 to other textures unless you have that other extension. Afaik the oes depth texture extension makes no mention that you should be able to render to level 1 and upwards.
#2) What should we do about GL_DEPTH_STENCIL format?

WebGL requires support for GL_DEPTH_STENCIL as a renderbuffer format. 

It seems like it also needs to require support for GL_DEPTH_STENCIL as a texture format for WEBGL_depth_texture
otherwise it's possible you can't use stencils with depth textures.

I'm not sure what issues that brings up.
I don't think it is required that any combination of things you attach to an FBO does work. Some combinations will fail (they're also failing right now). It is required that at least some combination allows you to render to a stencil, depth and color buffer, but unless you try and validate the FBO, you're not gonna know.