It appears that glColorMaterial()
is absent from OpenGL ES. According to this post (for iPhone), you may still enable GL_COLOR_MATERIAL
in OpenGL ES 1.x, but you're stuck with the default settings of GL_FRONT_AND_BACK
and GL_AMBIENT_AND_DIFFUSE
that you would otherwise set with glColorMaterial()
. I would be OK with this, but the diffuse lighting is not working correctly.
I set up my scene and tested it with one light, setting glMaterialfv()
for GL_AMBIENT
and GL_DIFFUSE
once in the initialization. The normals have been set correctly, and lighting works the way it's supposed to. I see the Gouraud shading.
With GL_LIGHTING
disabled, the flat colors I have set with glColor4f()
appear on the various objects in the scene. This also functions as expected. However, when glEnable(GL_COLOR_MATERIAL)
is called, the flat colors remain. I would expect to see the lighting effects.
glColorMaterial() is also mentioned on anddev.org, but I'm not sure if the information there is accurate.
I'm testing this on an Android 2.1 handset (Motorola Droid).
Edit: It works properly on my 1.6 handset (ADP1). I've filed Issue 8015. It does not work with the emulator for Android 1.6 or 2.1.
Here is a minimal testcase to reproduce the problem.
Screenshot on Android 1.6 (ADP1):
Screenshot of same code running on Android 2.1 (Motorola Droid):
Screenshot on Android 1.6 (Emulator):