Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can an OpenGL ES fragment shader change the depth value of a fragment?

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?

like image 521
seahorse Avatar asked Feb 29 '12 17:02

seahorse


1 Answers

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.

like image 151
Jerry Coffin Avatar answered Oct 25 '22 13:10

Jerry Coffin