PDA

View Full Version : Ambient lighting question



ryoko666
10-24-2012, 08:41 AM
I'm trying to use Light0 to light a simple scene. The scene is being lit, but polys which are facing away from the light are very dark. I tried setting the GL_AMBIENT value for light0 to something brighter than the default to correct this, however, it doesn't seem to have any effect. The polys facing away from the light are still very dark. Is there a trick to this?

dorbie
10-24-2012, 03:35 PM
You need to set the material ambient color to the desired value (probably just make it match your diffuse color). It's a bit redundant but it gives you more independent control of limited non physical lighting.

dorbie
10-24-2012, 03:35 PM
Note that this is all legacy functionality and you should try to progress to shaders when you are able.

ryoko666
10-25-2012, 07:53 AM
I'd love to use shaders. However, I'm writing for the lowest common denominator. My app is eventually going to be ported over to Android platforms and I'm not sure if Android supports shaders in openGL ES.

dorbie
10-25-2012, 10:22 AM
Any Android platform you care about has first class support for OpenGL ES 2.0 which is shaders only, no fixed function.

There is OpenGL ES 1.1 support usually through backwards compatability where the driver uses shaders for the fixed function pipeline you set up.

You should go with shaders for Android, and install Google's Angle API to develop for OpenGL ES on the desktop accross cards if Android is your target.

OpenGL desktop shaders are slightly different with more functionality and different keywords than OpenGL ES. Some of these changes are cosmetic. If you get Angle and code on it you know you will be writing portable code. It is shader based though :-)