summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Faye-Lund <erik.faye-lund@collabora.com>2020-09-07 18:30:29 +0200
committerErik Faye-Lund <erik.faye-lund@collabora.com>2020-09-14 11:05:31 +0000
commit8c1bc349f0de68d242bb5af6c8c5d260d01a9470 (patch)
treef9df6065b36e2de82253eebc805275ab6403571e
parent9c095ff0e359d3f3bbc1d15f399723c26e66a770 (diff)
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 <ajax@redhat.com>
-rw-r--r--src/egl/opengles2/es2gears.c6
1 files 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"