From 8c1bc349f0de68d242bb5af6c8c5d260d01a9470 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 7 Sep 2020 18:30:29 +0200 Subject: [PATCH] egl: match lighting of wglgears glxgears uses the default value for ambient light, which is 0.2. We should do the same. This makes these two demos look the same. Reviewed-by: Adam Jackson --- src/egl/opengles2/es2gears.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/egl/opengles2/es2gears.c b/src/egl/opengles2/es2gears.c index 39dc9a20..4a29c8f5 100644 --- a/src/egl/opengles2/es2gears.c +++ b/src/egl/opengles2/es2gears.c @@ -624,10 +624,12 @@ static const char vertex_shader[] = " // The LightSourcePosition is actually its direction for directional light\n" " vec3 L = normalize(LightSourcePosition.xyz);\n" "\n" +" float diffuse = max(dot(N, L), 0.0);\n" +" float ambient = 0.2;\n" +"\n" " // Multiply the diffuse value by the vertex color (which is fixed in this case)\n" " // to get the actual color that we will use to draw this vertex with\n" -" float diffuse = max(dot(N, L), 0.0);\n" -" Color = diffuse * MaterialColor;\n" +" Color = (ambient + diffuse) * MaterialColor;\n" "\n" " // Transform the position to clip coordinates\n" " gl_Position = ModelViewProjectionMatrix * vec4(position, 1.0);\n" -- 2.11.4.GIT