viewer :: Model -> IO ()
viewer model = do
  SDL.init [InitVideo]
  setCaption "ModelView" "ModelView"
  glSetAttribute glRedSize   8
  glSetAttribute glGreenSize 8
  glSetAttribute glBlueSize  8
  glSetAttribute glAlphaSize 8
  glSetAttribute glDepthSize 24
  glSetAttribute glDoubleBuffer 1
  setView 600 400
  cullFace  $= Nothing
  shadeModel $= Smooth
  normalize $= Enabled

  position (Light 0) $= Vertex4 1 1 1 0
  ambient  (Light 0) $= Color4 0.3 0.3 0.3 1
  diffuse  (Light 0) $= Color4 1 1 1 1
  --specular (Light 0) $= Color4 0 0 0 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 $= Just (FrontAndBack, AmbientAndDiffuse)
  materialSpecular FrontAndBack $= Color4 1 1 1 1
  materialEmission FrontAndBack $= Color4 0 0 0 1
  materialShininess FrontAndBack $= 30

  clearColor $= Color4 1 1 1 0
  clearDepth $= 1
  depthFunc  $= Just Less
  depthMask $= Enabled
  loop model initState
  quit
viewer :: Model -> IO ()
viewer model = do
  SDL.init [InitVideo]
  setCaption "ModelView" "ModelView"
  glSetAttribute glRedSize   8
  glSetAttribute glGreenSize 8
  glSetAttribute glBlueSize  8
  glSetAttribute glAlphaSize 8
  glSetAttribute glDepthSize 24
  glSetAttribute glDoubleBuffer 1
  setView 600 400
  cullFace  $= Nothing
  shadeModel $= Smooth
  normalize $= Enabled

  position (Light 0) $= Vertex4 1 1 1 0
  ambient  (Light 0) $= Color4 0.3 0.3 0.3 1
  diffuse  (Light 0) $= Color4 1 1 1 1
  --specular (Light 0) $= Color4 0 0 0 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 $= Just (FrontAndBack, AmbientAndDiffuse)
  materialSpecular FrontAndBack $= Color4 1 1 1 1
  materialEmission FrontAndBack $= Color4 0 0 0 1
  materialShininess FrontAndBack $= 30

  clearColor $= Color4 1 1 1 0
  clearDepth $= 1
  depthFunc  $= Just Less
  depthMask $= Enabled
  loop model initState
  quit
viewer model = do
  SDL.init [InitVideo]
  setCaption "ModelView" "ModelView"
  glSetAttribute glRedSize   8
  glSetAttribute glGreenSize 8
  glSetAttribute glBlueSize  8
  glSetAttribute glAlphaSize 8
  glSetAttribute glDepthSize 24
  glSetAttribute glDoubleBuffer 1
  setView 600 400
  cullFace  $= Nothing
  shadeModel $= Smooth
  normalize $= Enabled

  position (Light 0) $= Vertex4 1 1 1 0
  ambient  (Light 0) $= Color4 0.3 0.3 0.3 1
  diffuse  (Light 0) $= Color4 1 1 1 1
  --specular (Light 0) $= Color4 0 0 0 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 $= Just (FrontAndBack, AmbientAndDiffuse)
  materialSpecular FrontAndBack $= Color4 1 1 1 1
  materialEmission FrontAndBack $= Color4 0 0 0 1
  materialShininess FrontAndBack $= 30

  clearColor $= Color4 1 1 1 0
  clearDepth $= 1
  depthFunc  $= Just Less
  depthMask $= Enabled
  loop model initState
  quit