[HOpenGL] Basic Lighting for CAD

Tom Hawkins tomahawkins at gmail.com
Tue Sep 8 18:24:26 EDT 2009


On Tue, Sep 8, 2009 at 1:23 PM, Christopher Lane Hinson
<lane at downstairspeople.org> wrote:
>
>>  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.

Yes, this is a type error.  I forgot to remove it.

Normalizing the normals and shutting off specular improved the scene the most.

Thanks!

>
> 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