When torus object is scaled up/down via glScalef call the lighting effect is incorrectly expressed on render target because normals' length is also changed when vertices are scaled up/down.
This patch enables "automatic normalization" of normals, which is one of well-known ways to avoid this kind of distortion. Reference: www.opengl.org/sdk/docs/man2/xhtml/glScale.xml Notes If scale factors other than 1 are applied to the modelview matrix and lighting is enabled, lighting often appears wrong. In that case, enable automatic normalization of normals by calling glEnable with the argument GL_NORMALIZE. Signed-off-by: Dongwon Kim <dongwon....@intel.com> --- src/egl/opengles1/torus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/egl/opengles1/torus.c b/src/egl/opengles1/torus.c index 8f262b5..bb20670 100644 --- a/src/egl/opengles1/torus.c +++ b/src/egl/opengles1/torus.c @@ -358,6 +358,10 @@ init(void) make_texture(); glEnable(GL_TEXTURE_2D); + + /* Enabling automatic normalizing to prevent wrong expression of lighting + when torus is scaled down via glScalef */ + glEnable(GL_NORMALIZE); } -- 1.7.9.5 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev