[HOpenGL] Basic Lighting for CAD

Tom Hawkins tomahawkins at gmail.com
Tue Sep 8 12:01:26 EDT 2009


Hi,

I'm looking for a basic lighting configuration for a solid modeller
I'm building.  I don't need anything elaborate; I just want to set a
color and get reasonable shading.  I followed the guidelines from
http://www.opengl.org/wiki/How_lighting_works, but my scenes are left
only black and white (http://funhdl.org/ball.jpg).  Are there any
specifics to the Haskell API to properly configure lighting?  Here are
the lighting commands I call during program init:

  position (Light 0) $= Vertex4 1 1 0 1
  ambient  (Light 0) $= Color4 0 0 0 1
  diffuse  (Light 0) $= Color4 1 1 1 1
  specular (Light 0) $= Color4 1 1 1 1
  lightModelAmbient $= Color4 0.2 0.2 0.2 1
  lighting $= Enabled
  light (Light 0) $= Enabled
  colorMaterial $= Enabled
  colorMaterial $= Just (FrontAndBack, AmbientAndDiffuse)
  materialSpecular FrontAndBack $= Color4 1 1 1 1
  materialEmission FrontAndBack $= Color4 0 0 0 1

During a frame redraw, the only lighting functions called are
disabling and enabling lighting to draw the coordinate system.

Any ideas or recommendations?

BTW, I also raised this question to the opengl forum:
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=263558

-Tom


More information about the HOpenGL mailing list