diff options
Diffstat (limited to 'advanced_opengl/1.depth/shaders/depth.fs')
-rw-r--r-- | advanced_opengl/1.depth/shaders/depth.fs | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/advanced_opengl/1.depth/shaders/depth.fs b/advanced_opengl/1.depth/shaders/depth.fs deleted file mode 100644 index a515c15..0000000 --- a/advanced_opengl/1.depth/shaders/depth.fs +++ /dev/null @@ -1,27 +0,0 @@ -#version 330 core - -out vec4 frag_color; - -in vec2 tex_coords; - -uniform sampler2D our_texture; - -float near = 0.1; -float far = 100.0; - -float -linearize_depth(float depth) -{ - float ndc_z = 2.0*depth-1.0; - return((2.0*near*far)/(far+near-ndc_z*(far-near))); -} - -void -main(void) -{ - /* - frag_color = texture(our_texture, tex_coords); - */ - float depth = linearize_depth(gl_FragCoord.z)/far; - frag_color = vec4(vec3(depth), 1.0); -} |