Created
March 8, 2020 09:30
-
-
Save anirul/aca408c8ee7cd483f3e04b5c0092f8fd to your computer and use it in GitHub Desktop.
Simple fragment shader to show a model with texture.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 410 core | |
layout(location = 0) out vec4 frag_color; | |
in vec3 out_normal; | |
in vec2 out_texcoord; | |
uniform sampler2D texture1; | |
void main() | |
{ | |
vec3 light_position = vec3(0.0, 0.0, 1.0); | |
float shade = clamp(dot(light_position, out_normal), 0.0, 1.0); | |
frag_color = | |
vec4(shade, shade, shade, 1.0) * | |
texture(texture1, out_texcoord); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment