diff options
Diffstat (limited to 'shaders')
-rw-r--r-- | shaders/main.frag | 12 | ||||
-rw-r--r-- | shaders/main.vert | 14 | ||||
-rw-r--r-- | shaders/skybox.frag | 19 | ||||
-rw-r--r-- | shaders/skybox.vert | 20 |
4 files changed, 15 insertions, 50 deletions
diff --git a/shaders/main.frag b/shaders/main.frag index 8eb47ec..7120521 100644 --- a/shaders/main.frag +++ b/shaders/main.frag @@ -1,10 +1,6 @@ -#version 330 core - -in vec3 norm; -in vec2 uv; -in vec3 frag_pos; - -out vec4 final_col; +varying vec3 norm; +varying vec2 uv; +varying vec3 frag_pos; uniform sampler2D tex; @@ -16,5 +12,5 @@ void main() { float diff = max(dot(normalize(norm), light_dir), 0.0); vec3 diffuse = diff * light_col; - final_col = texture(tex, uv) * vec4(ambient + diffuse, 1); + gl_FragColor = texture2D(tex, uv) * vec4(ambient + diffuse, 1); } diff --git a/shaders/main.vert b/shaders/main.vert index 33e6849..d05a0da 100644 --- a/shaders/main.vert +++ b/shaders/main.vert @@ -1,12 +1,10 @@ -#version 330 core +attribute vec3 in_pos; +attribute vec3 in_norm; +attribute vec2 in_uv; -layout(location = 0) in vec3 in_pos; -layout(location = 1) in vec3 in_norm; -layout(location = 2) in vec2 in_uv; - -out vec3 norm; -out vec2 uv; -out vec3 frag_pos; +varying vec3 norm; +varying vec2 uv; +varying vec3 frag_pos; uniform mat4 proj; uniform mat4 view; diff --git a/shaders/skybox.frag b/shaders/skybox.frag index f5f8edb..e056670 100644 --- a/shaders/skybox.frag +++ b/shaders/skybox.frag @@ -1,23 +1,8 @@ -#version 330 core - -// in vec3 tex_coord; - -// out vec4 final_col; - -// uniform samplerCube skybox; - -// void main() { -// // final_col = texture(skybox, tex_coord); -// final_col = vec4(0, 0, 0, 1); -// } - -in vec3 tex_coords; - -out vec4 final_col; +varying vec3 tex_coords; uniform samplerCube tex; void main() { - final_col = texture(tex, tex_coords); + gl_FragColor = textureCube(tex, tex_coords); // final_col = vec4(1, 0, 1, 1); } diff --git a/shaders/skybox.vert b/shaders/skybox.vert index ac4ac5e..2ab8497 100644 --- a/shaders/skybox.vert +++ b/shaders/skybox.vert @@ -1,22 +1,8 @@ -#version 330 core +#version 120 -// layout(location = 0) in vec3 in_pos; +attribute vec3 in_pos; -// out vec3 tex_coords; - -// uniform mat4 proj; -// uniform mat4 view; - -// void main() { -// // vec4 pos = proj * view * vec4(in_pos, 1.0); -// // gl_Position = pos.xyww; -// gl_Position = proj * vec4(in_pos, 1.0); -// tex_coords = in_pos; -// } - -layout(location = 0) in vec3 in_pos; - -out vec3 tex_coords; +varying vec3 tex_coords; uniform mat4 proj; uniform mat4 view; |