Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 130
- precision highp float;
- const vec3 ambient = vec3(0, 0.0, 0.0);
- const vec3 lightVecNormalized = normalize(vec3(0.0, 0.5, 0.0));
- const vec3 lightColor = vec3(0.0, 0.0, 0.5);
- uniform sampler2D tex;
- in vec3 normal;
- out vec4 out_frag_color;
- void main(void)
- {
- float diffuse = clamp(dot(lightVecNormalized, normalize(normal)), 0.0, 1.0);
- vec4 color = texture2D(tex,gl_TexCoord[0].st);
- //out_frag_color = vec4(color + (ambient+ diffuse * lightColor), 1.0);
- out_frag_color = color+vec4(ambient+ diffuse * lightColor, 0.5);
- }
- #version 130
- precision highp float;
- uniform mat4 projection_matrix;
- uniform mat4 modelview_matrix;
- attribute vec4 gl_MultiTexCoord0;
- in vec3 in_position;
- in vec3 in_normal;
- in vec4 in_texture;
- out vec3 normal;
- void main(void)
- {
- gl_TexCoord[0] = in_texture;
- //works only for orthogonal modelview
- normal = (modelview_matrix * vec4(in_normal, 0)).xyz;
- gl_Position = projection_matrix * modelview_matrix * vec4(in_position, 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement