Can an OpenGL ES fragment shader change the depth

2019-04-23 14:21发布

Can fragment shader in OpenGL ES 2.0 change the Z value (depth) of a pixel?

How is this achieved in OpenGL ES 2.0?

1条回答
Bombasti
2楼-- · 2019-04-23 14:59

No -- gl_FragDepth (which is part of the desktop version of GLSL) is not present in OpenGL ES.

You can, however, check for the existence of GL_EXT_frag_depth. If it's available, then you can write the depth to gl_FragDepthEXT.

The extension paper gives more details about how to enable the extension and such.

查看更多
登录 后发表回答