[HOpenGL] Basic Lighting for CAD

Christopher Lane Hinson lane at downstairspeople.org
Tue Sep 8 13:23:22 EDT 2009


>  colorMaterial $= Enabled
>  colorMaterial $= Just (FrontAndBack, AmbientAndDiffuse)

Something's wrong.  I don't think that should typecheck.  IIUC setting 
colorMaterial to Just or Nothing enables or disables it respectively.

A number of different things could be going wrong.  To simplify things:

* Set the light source position to Vector4 1 1 0 0 <-- note the last zero
This makes the light source infinite, which is a simpler lighting model.

* Turn the specular lighting to zero, also for a simpler lighting model.

(When you use specular and point lighting at the same time, you usually 
also want to enable lightModelLocalViewer, but hold off until you have 
the basics working.)

* Turn colorMaterial off, and just use a plain blue sphere (e.g. 
glutSolidSphere).

* Follow the advice on the other thread about enabling GL_NORMALIZE.

As you turn off features, you should see something conspicuous that 
illuminates (sorry) the problem.

Once you have a scene that looks reasonable, you can start re-enabling 
features one by one.

Friendly,
--Lane


More information about the HOpenGL mailing list