drawAxis :: IO DisplayList
drawAxis = do

  defineNewList CompileAndExecute $ do
    c <- get currentColor
    let len = 500.0
        step = 1
        apply3 f (x, y, z) = (f x, f y, f z)
        xv = (1.0, 0, 0)
        yv = (0.0, 1.0, 0)
        zv = (0.0, 0.0, 1.0)
        rl = [step , step + step .. len]
    preservingMatrix $ do
      -- X
      color $ Color3 1.0 0.0 (0.0 :: GLfloat)

      renderPrimitive Lines $ mapM_ vertex3f $
        [ (0.0, 0.0, 0.0)
        , apply3 (* len) xv
        ] ++ concat (map (\x -> [(x, 0, -1) , (x, 0, 1)] ) rl)

      -- Y
      color $ Color3 0.0 1.0 (0.0 :: GLfloat)

      renderPrimitive Lines $ mapM_ vertex3f $
        [ (0.0, 0.0, 0.0)
        , apply3 (* len) yv
        ] ++ concat (map (\x -> [(-1, x, 0) , (1, x, 0)] ) rl)
          ++ concat (map (\x -> [(0, x, -1) , (0, x, 1)] ) rl)

      -- Z
      color $ Color3 0.0 0.0 (1.0 :: GLfloat)

      renderPrimitive Lines $ mapM_ vertex3f $
        [ (0.0, 0.0, 0.0)
        , apply3 (* len) zv
        ] ++ concat (map (\x -> [(-1, 0, x) , (1, 0, x)] ) rl)

    color c

-- | Renders information using the current 'ProgramState'
drawAxis :: IO DisplayList
drawAxis = do

  defineNewList CompileAndExecute $ do
    c <- get currentColor
    let len = 500.0
        step = 1
        apply3 f (x, y, z) = (f x, f y, f z)
        xv = (1.0, 0, 0)
        yv = (0.0, 1.0, 0)
        zv = (0.0, 0.0, 1.0)
        rl = [step , step + step .. len]
    preservingMatrix $ do
      -- X
      color $ Color3 1.0 0.0 (0.0 :: GLfloat)

      renderPrimitive Lines $ mapM_ vertex3f $
        [ (0.0, 0.0, 0.0)
        , apply3 (* len) xv
        ] ++ concat (map (\x -> [(x, 0, -1) , (x, 0, 1)] ) rl)

      -- Y
      color $ Color3 0.0 1.0 (0.0 :: GLfloat)

      renderPrimitive Lines $ mapM_ vertex3f $
        [ (0.0, 0.0, 0.0)
        , apply3 (* len) yv
        ] ++ concat (map (\x -> [(-1, x, 0) , (1, x, 0)] ) rl)
          ++ concat (map (\x -> [(0, x, -1) , (0, x, 1)] ) rl)

      -- Z
      color $ Color3 0.0 0.0 (1.0 :: GLfloat)

      renderPrimitive Lines $ mapM_ vertex3f $
        [ (0.0, 0.0, 0.0)
        , apply3 (* len) zv
        ] ++ concat (map (\x -> [(-1, 0, x) , (1, 0, x)] ) rl)

    color c

-- | Renders information using the current 'ProgramState'
drawAxis = do

  defineNewList CompileAndExecute $ do
    c <- get currentColor
    let len = 500.0
        step = 1
        apply3 f (x, y, z) = (f x, f y, f z)
        xv = (1.0, 0, 0)
        yv = (0.0, 1.0, 0)
        zv = (0.0, 0.0, 1.0)
        rl = [step , step + step .. len]
    preservingMatrix $ do
      -- X
      color $ Color3 1.0 0.0 (0.0 :: GLfloat)

      renderPrimitive Lines $ mapM_ vertex3f $
        [ (0.0, 0.0, 0.0)
        , apply3 (* len) xv
        ] ++ concat (map (\x -> [(x, 0, -1) , (x, 0, 1)] ) rl)

      -- Y
      color $ Color3 0.0 1.0 (0.0 :: GLfloat)

      renderPrimitive Lines $ mapM_ vertex3f $
        [ (0.0, 0.0, 0.0)
        , apply3 (* len) yv
        ] ++ concat (map (\x -> [(-1, x, 0) , (1, x, 0)] ) rl)
          ++ concat (map (\x -> [(0, x, -1) , (0, x, 1)] ) rl)

      -- Z
      color $ Color3 0.0 0.0 (1.0 :: GLfloat)

      renderPrimitive Lines $ mapM_ vertex3f $
        [ (0.0, 0.0, 0.0)
        , apply3 (* len) zv
        ] ++ concat (map (\x -> [(-1, 0, x) , (1, 0, x)] ) rl)

    color c

-- | Renders information using the current 'ProgramState'