summaryrefslogtreecommitdiff
path: root/advanced_opengl/1.depth
diff options
context:
space:
mode:
authorpryazha <pryadeiniv@mail.ru>2025-02-06 12:38:09 +0500
committerpryazha <pryadeiniv@mail.ru>2025-02-06 12:38:09 +0500
commit926cbd0d49890772f911e6a6bedb7835605ced89 (patch)
treeea27e2c84e32ab6d8d29af9e61cd432e30a46bc6 /advanced_opengl/1.depth
parentbf1c59565096ac9774493846cfb15e259d3b0e66 (diff)
change
Diffstat (limited to 'advanced_opengl/1.depth')
-rwxr-xr-xadvanced_opengl/1.depth/build.sh2
-rwxr-xr-xadvanced_opengl/1.depth/depthbin1282576 -> 1282544 bytes
-rw-r--r--advanced_opengl/1.depth/shaders/depth.fs10
-rw-r--r--advanced_opengl/1.depth/shaders/depth.vs2
4 files changed, 7 insertions, 7 deletions
diff --git a/advanced_opengl/1.depth/build.sh b/advanced_opengl/1.depth/build.sh
index 837b21c..04fe803 100755
--- a/advanced_opengl/1.depth/build.sh
+++ b/advanced_opengl/1.depth/build.sh
@@ -2,4 +2,4 @@
. ../../config
TARGET='depth'
set -x
-gcc -o $TARGET $CFLAGS $INCLUDE $LFLAGS $TARGET.c $LIBS && ./$TARGET
+gcc -o $TARGET $CFLAGS $INCLUDE $LFLAGS $TARGET.c $LIBS
diff --git a/advanced_opengl/1.depth/depth b/advanced_opengl/1.depth/depth
index db67630..68f04d6 100755
--- a/advanced_opengl/1.depth/depth
+++ b/advanced_opengl/1.depth/depth
Binary files differ
diff --git a/advanced_opengl/1.depth/shaders/depth.fs b/advanced_opengl/1.depth/shaders/depth.fs
index 2f3d9ca..a515c15 100644
--- a/advanced_opengl/1.depth/shaders/depth.fs
+++ b/advanced_opengl/1.depth/shaders/depth.fs
@@ -6,14 +6,14 @@ in vec2 tex_coords;
uniform sampler2D our_texture;
-float near = 0.1f;
-float far = 100.0f;
+float near = 0.1;
+float far = 100.0;
float
linearize_depth(float depth)
{
- float ndc_z = 2.0f*depth-1.0f;
- return((2.0f*near*far)/(far+near-ndc_z*(far-near)));
+ float ndc_z = 2.0*depth-1.0;
+ return((2.0*near*far)/(far+near-ndc_z*(far-near)));
}
void
@@ -23,5 +23,5 @@ main(void)
frag_color = texture(our_texture, tex_coords);
*/
float depth = linearize_depth(gl_FragCoord.z)/far;
- frag_color = vec4(vec3(depth), 1.0f);
+ frag_color = vec4(vec3(depth), 1.0);
}
diff --git a/advanced_opengl/1.depth/shaders/depth.vs b/advanced_opengl/1.depth/shaders/depth.vs
index d3d92d1..62e71a2 100644
--- a/advanced_opengl/1.depth/shaders/depth.vs
+++ b/advanced_opengl/1.depth/shaders/depth.vs
@@ -11,6 +11,6 @@ out vec2 tex_coords;
void
main(void)
{
- gl_Position = projection*view*model*vec4(apos, 1.0f);
+ gl_Position = projection*view*model*vec4(apos, 1.0);
tex_coords = atex_coords;
}