Hi,
I apologize if this question has been ask before, but I haven’t had much luck googling around. I’m building a little solid modeller and am looking for a basic lighting configuration to provide a reasonable view of surface features. I don’t want to do anything fancy; I just want to be able change an object’s color and get decent shading.
When I follow the guidelines from “How lighting works”, I’m left with a scene that is mostly black and white (the sphere in the picture should be blue):
Here are the lighting commands I call during program init. I’m using Haskell with its opengl binding. The syntax may look weird, but hopefully the underlying opengl calls can be recognised:
position (Light 0) = Vertex4 1 1 0 1
ambient (Light 1) = Color4 0 0 0 1
diffuse (Light 1) = Color4 1 1 1 1
specular (Light 1) = Color4 1 1 1 1
lightModelAmbient = Color4 0.2 0.2 0.2 1
lighting = Enabled
light (Light 0) = Enabled
colorMaterial = Just (FrontAndBack, AmbientAndDiffuse)
materialSpecular FrontAndBack = Color4 1 1 1 1
materialEmission FrontAndBack = Color4 0 0 0 1
Any idea what I’m doing wrong? Also, should I be calling any lighting specific stuff during frame redraws, or just at initialization? And what happens if a disable and re-enable lighting? Do I need to reset all the lighting parameters?
Thanks for any help!
-Tom