depth-buffer

OpenGL ES2 Alpha test problems

痞子三分冷 提交于 2019-11-26 02:57:50
问题 I am rendering in 3D multiple objects with textures that have alpha. All the textures load fine but when I try to render them in front of each other I get the following: Left is what I have. Right is what it should be. The grid is just to help visualize the perspective. The texture in front of the red circle texture is clipped. I searched around for an answer and it says for me to use: GLES20.glEnable( GLES20.GL_BLEND ); GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA );

How to render depth linearly in modern OpenGL with gl_FragCoord.z in fragment shader?

和自甴很熟 提交于 2019-11-26 01:02:01
问题 I read lots of information about getting depth with fragment shader. such as http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=234519 but I still don\'t know whether or not the gl_FragCoord.z is linear. GLSL specification said its range is [0,1] in screen sapce without mentioning it\'s linear or not. I think linearity it is vital since I will use the rendered model to match depth map from Kinect. Then if it is not linear, how to linearlize it in the world space? 回答1: