Commit Graph

9 Commits

Author SHA1 Message Date
Martin Storsjo
d5b1cda91e libagl: Transform the vertex if using eye space lighting with point lights
This fixes lighting when using point lights, when eye space
lighting is used (which is the default).

Change-Id: I0cd0d2329893d6b5f8af3b1e595274c2076fc322
2012-07-12 16:59:20 +03:00
Mathias Agopian
04a3f57d19 fix [2133133] Software OpenGL ES Lighting is buggy (GL Gears washed out bug)
A typo caused GL_AMBIENT_AND_DIFFUSE to only set the the ambient color.

Fix another typo which caused the viewer position to be wrong for
specular highlights.

Switch back to eye-space lighting, since there are still some issues
with some demos (San Angeles in particular).
2010-02-03 12:13:15 -08:00
Martin Storsjo
e03eaa1551 Calculate specular lighting correctly
Since the lighting calculations are done in object space, the vector
from the object to the viewer also needs to be transformed to object
space.
2009-08-25 18:35:54 -07:00
Mathias Agopian
69ca17a124 fix [1610840] Positional light doesn't work correctly on emulator
This bug was introduced when lighting computations was changed from eye-space to object-space.
The light position need to be transformed back to object-space each time the modelview matrix changes which requires us to compute the inverse of the modelview matrix. This computation was done with the assumption that normals where transformed (which was the case when the computation was made in eye-space), however, normals only require the inverse of the upper 3x3 matrix while transforming positions requires the inverse of the whole matrix.
This caused the interesting behavior that lights were more-or-less transformed properly, but not translated at all, which caused improper lighting with directional lights in particular.

There was also another smaller bug affecting directional lights: when vertices are read, only the active component are read, the other ones are ignored, later, the transformation operations are set up to ignore the unset values, howver, in the case of lighting, we use the vertex in object space (that is, before it is transformed), and therefore were using uninitalized values; in particular w.
2009-06-03 15:09:52 -07:00
Mathias Agopian
50aba6d31d fix a bug in GL lighting where the specular component could be ommited when vertex material was disabled.
the specular enable flag wasn't computed in that case.
2009-06-02 22:51:09 -07:00
The Android Open Source Project
edbf3b6af7 auto import from //depot/cupcake/@135843 2009-03-03 19:31:44 -08:00
The Android Open Source Project
d5193d9394 auto import from //depot/cupcake/@135843 2009-03-03 18:28:45 -08:00
The Android Open Source Project
e09fd9e819 Code drop from //branches/cupcake/...@124589 2008-12-17 18:05:43 -08:00
The Android Open Source Project
7c1b96a165 Initial Contribution 2008-10-21 07:00:00 -07:00