一个OpenGL ES片段着色器可以改变一个片段的深度值? [英] Can an OpenGL ES fragment shader change the depth value of a fragment?

查看:561
本文介绍了一个OpenGL ES片段着色器可以改变一个片段的深度值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

能否片段着色器在OpenGL ES 2.0的变化像素的Z值(深度)?

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

这是如何在OpenGL ES 2.0的实现?

How is this achieved in OpenGL ES 2.0?

推荐答案

没有 - gl_FragDepth (这是GLSL桌面版本的一部分)没有present在OpenGL ES的。

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

您可以,但是,检查 GL_EXT_frag_depth 的存在。如果是可用的,那么你可以写深度 gl_FragDepthEXT

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.

这篇关于一个OpenGL ES片段着色器可以改变一个片段的深度值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆