import obj shader changes into obj_tex

This commit is contained in:
Josh Holtrop 2012-09-15 08:43:59 -04:00
parent c7af7f8f2f
commit 05dc0b021f
2 changed files with 7 additions and 3 deletions

View File

@ -17,7 +17,7 @@ void main(void)
color = vec4(0.2, 0.2, 0.2, 1.0) * ambient; /* ambient light */
n = normalize(normal_i);
NdotL = max(dot(n, -lightDir), 0.0);
NdotL = dot(n, -lightDir);
if (NdotL > 0.0)
{

View File

@ -1,4 +1,8 @@
uniform float scale;
uniform mat4 projection;
uniform mat4 modelview;
attribute vec3 pos;
attribute vec3 normal;
attribute vec2 tex_coord;
@ -9,8 +13,8 @@ varying vec2 tex_coord_i;
void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * vec4(pos, 1);
gl_Position = projection * modelview * vec4(scale * pos, 1);
pos_i = gl_Position.xyz;
tex_coord_i = tex_coord;
normal_i = gl_NormalMatrix * normal;
normal_i = modelview * vec4(normal, 0);
}